Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven profiles are not considered in Eclipse

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).

like image 356
du-it Avatar asked Oct 02 '13 15:10

du-it


People also ask

What is a Maven profile?

A profile in Maven is an alternative set of configuration values which set or override default values. Using a profile, you can customize a build for different environments. Profiles are configured in the pom. xml and are given an identifier.


2 Answers

Right click your project in the Project Explorer then go to

Properties --> Maven --> Active Maven Profiles

enter image description here

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(separated 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.

like image 68
Abdullah Khan Avatar answered Sep 25 '22 02:09

Abdullah Khan


verify that plugin execution id are not equal in different profiles

like image 42
Pippo Basta Avatar answered Sep 25 '22 02:09

Pippo Basta