Maven profiles are not considered in Eclipse

du-it picture du-it · Oct 2, 2013 · Viewed 37.8k times · Source

I have three profiles defined in my pom.xml:

   <profiles>
    <profile>
        <id>ABC</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <url.base>http://server1.de</url.base>
            <url.searchevse>/search</url.searchevse>
            <url.reservation>/reservation</url.reservation>
            <url.cancelation>/reservation/cancel</url.cancelation>
            <xxx.devmode>false</xxx.devmode>
        </properties>
    </profile>
    <profile>
        <id>XYZ</id>
        <properties>
            <url.base>http://server2.de</url.base>
            <url.searchevse>/cns/search</url.searchevse>
            <url.reservation>/cns/reservation</url.reservation>
            <url.cancelation>/cns/cancel_reservation</url.cancelation>
            <xxx.devmode>false</xxx.devmode>
        </properties>
    </profile> 
   <profile>
        <id>DEVELOPMENT</id>
        <properties>
            <url.base>http://localhost/noservices</url.base>
            <url.searchevse>/no/search</url.searchevse>
            <url.reservation>/no/reservation</url.reservation>
            <url.cancelation>/no/cancel_reservation</url.cancelation>
            <xxx.devmode>true</xxx.devmode>
        </properties>
    </profile>
</profiles>

In Eclipse I have a Run Configuration

clean install XYZ

and I tried both using -PXYZ (and -P XYZ) in the Goals field as well as

clean install

in the Goals field and XYZ in the Profiles field.

The problem:

The defined profile is never used.

Inserting the active profile under Properties-->Maven-->Active Maven Profiles doesn't work (or do I have to use a special syntax, e.g. no spaces after a comma or so).

Answer

Abdullah Khan picture Abdullah Khan · Feb 13, 2016

Go to

Properties-->Maven-->Active Maven Profiles

and type in only the profile name that you want to run.

If you want to run your ABC profile type in ABC in the Active Maven Profile input box.

The description(seperated by commas) given there is a bit confusing.

Once you define your profile name or id in the input box. You can clean and run your project on your server. By doing so your mentioned active maven profile will be run.