You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Javix <se...@atos.net> on 2012/12/05 14:53:05 UTC

Re: Getting profile settings values in a Java class

I'm back with a strange behaviour. In a separate project which has profiles
defined exactly the same way, passing the option '-P [profile name]' does
not work at all, Maven continues to use the default activated profile. Here
is a working example:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.spot.sncf</groupId>
	<artifactId>java_cukes</artifactId>
	<version>1.0-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>java_cukes</name>
	<url>http://maven.apache.org</url>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.3.2</version>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-site-plugin</artifactId>
				<version>3.1</version>
				<configuration>
					<reportPlugins>
						<plugin>
							<groupId>org.apache.maven.plugins</groupId>
							<artifactId>maven-surefire-report-plugin</artifactId>
							<version>2.4.3</version>
						</plugin>
					</reportPlugins>
				</configuration>
			</plugin>
		</plugins>

		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>
	</build>
	
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	</properties>

	<profiles>
		<profile>
			<id>dev</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<properties>
				<host>http://toto.com</host>
			</properties>
		</profile>
		<profile>
			<id>vm</id>
			<properties>
				<host>http://yoyo.com</host>
			</properties>
		</profile>
	</profiles>


	<dependencies>
		<dependency>
			<groupId>info.cukes</groupId>
			<artifactId>cucumber-picocontainer</artifactId>
			<version>1.1.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>info.cukes</groupId>
			<artifactId>cucumber-junit</artifactId>
			<version>1.1.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.10</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

</project>

Executing

mvn test

will run the activated default profile (vm).

Running

mvn test -P vm

will run the 'vm' prifile.

Using the same but in a different project runs only the activated profile,
no matter if I pass -P option.
Any idea?

Thanks





--
View this message in context: http://maven.40175.n5.nabble.com/Getting-profile-settings-values-in-a-Java-class-tp5722740p5735821.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Getting profile settings values in a Java class

Posted by Ron Wheeler <rw...@artifact-software.com>.
You need to provide more information.

Ron

On 06/12/2012 2:09 PM, Javix wrote:
> it means
>
> <activeByDefault>true</activeByDefault>
>
> Regards
> ________________________________
> From: Ron Wheeler [via Maven] [ml-node+s40175n5735905h71@n5.nabble.com]
> Sent: 06 December 2012 14:33
> To: CAMBOUR Serguei
> Subject: Re: Getting profile settings values in a Java class
>
> Or the error messages.
> Or what the "it" is in "So I have to set it up explicitly every time in
> the POM file. Here is my configuration:"
>
> Ron
>
> On 06/12/2012 3:35 AM, Anders Hammar wrote:
>
>> This is probably difficult to solve without access to the actual
>> problematic project.
>>
>> /Anders
>>
>>
>> On Thu, Dec 6, 2012 at 9:25 AM, Javix <[hidden email]<UrlBlockedError.aspx>> wrote:
>>
>>> I knew those option to desactivate a profile. The problem that I can't
>>> figure
>>> out how to solve is WHY the same Maven configuration works in one project
>>> and not at all in another? By the way, if comment out the line
>>>
>>> <activation>
>>>     <activeByDefault>true</activeByDefault>
>>> </activation>
>>>
>>> and run
>>>
>>> mvn test -P [profile_to_use]
>>>
>>> it works fine too. But in another project, no matter the way I use to run
>>> Maven tests (commenting out the profile activation lines, running with
>>> negation option (![profile_not_to_use], [profile_to_use], it does not work
>>> and fails. So I have to set it up explicitly every time in the POM file.
>>> Here is my configuration:
>>>
>>> Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
>>> Maven home: C:\Apache\apache-maven-3.0.4
>>> Java version: 1.6.0_21, vendor: Sun Microsystems Inc.
>>> Java home: C:\Program Files\Java\jdk1.6.0_21\jre
>>> Default locale: fr_FR, platform encoding: Cp1252
>>> OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"
>>>
>>> Regards
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://maven.40175.n5.nabble.com/Getting-profile-settings-values-in-a-Java-class-tp5722740p5735884.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]<UrlBlockedError.aspx>
>>> For additional commands, e-mail: [hidden email]<UrlBlockedError.aspx>
>>>
>>>
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: [hidden email]<UrlBlockedError.aspx>
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<UrlBlockedError.aspx>
> For additional commands, e-mail: [hidden email]<UrlBlockedError.aspx>
>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://maven.40175.n5.nabble.com/Getting-profile-settings-values-in-a-Java-class-tp5722740p5735905.html
> To unsubscribe from Getting profile settings values in a Java class, click here<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5722740&code=c2VyZ3VlaS5jYW1ib3VyQGF0b3MubmV0fDU3MjI3NDB8MTY2NTQxNzk3MQ==>.
> NAML<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> ________________________________
>
> Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité du groupe Atos ne pourra être engagée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être engagée pour tout dommage résultant d'un virus transmis.
>
> This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.
>
>
>
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Getting-profile-settings-values-in-a-Java-class-tp5722740p5735950.html
> Sent from the Maven - Users mailing list archive at Nabble.com.


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Getting profile settings values in a Java class

Posted by Javix <se...@atos.net>.
it means

<activeByDefault>true</activeByDefault>

Regards
________________________________
From: Ron Wheeler [via Maven] [ml-node+s40175n5735905h71@n5.nabble.com]
Sent: 06 December 2012 14:33
To: CAMBOUR Serguei
Subject: Re: Getting profile settings values in a Java class

Or the error messages.
Or what the "it" is in "So I have to set it up explicitly every time in
the POM file. Here is my configuration:"

Ron

On 06/12/2012 3:35 AM, Anders Hammar wrote:

> This is probably difficult to solve without access to the actual
> problematic project.
>
> /Anders
>
>
> On Thu, Dec 6, 2012 at 9:25 AM, Javix <[hidden email]<UrlBlockedError.aspx>> wrote:
>
>> I knew those option to desactivate a profile. The problem that I can't
>> figure
>> out how to solve is WHY the same Maven configuration works in one project
>> and not at all in another? By the way, if comment out the line
>>
>> <activation>
>>    <activeByDefault>true</activeByDefault>
>> </activation>
>>
>> and run
>>
>> mvn test -P [profile_to_use]
>>
>> it works fine too. But in another project, no matter the way I use to run
>> Maven tests (commenting out the profile activation lines, running with
>> negation option (![profile_not_to_use], [profile_to_use], it does not work
>> and fails. So I have to set it up explicitly every time in the POM file.
>> Here is my configuration:
>>
>> Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
>> Maven home: C:\Apache\apache-maven-3.0.4
>> Java version: 1.6.0_21, vendor: Sun Microsystems Inc.
>> Java home: C:\Program Files\Java\jdk1.6.0_21\jre
>> Default locale: fr_FR, platform encoding: Cp1252
>> OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"
>>
>> Regards
>>
>>
>>
>> --
>> View this message in context:
>> http://maven.40175.n5.nabble.com/Getting-profile-settings-values-in-a-Java-class-tp5722740p5735884.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]<UrlBlockedError.aspx>
>> For additional commands, e-mail: [hidden email]<UrlBlockedError.aspx>
>>
>>


--
Ron Wheeler
President
Artifact Software Inc
email: [hidden email]<UrlBlockedError.aspx>
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]<UrlBlockedError.aspx>
For additional commands, e-mail: [hidden email]<UrlBlockedError.aspx>



________________________________
If you reply to this email, your message will be added to the discussion below:
http://maven.40175.n5.nabble.com/Getting-profile-settings-values-in-a-Java-class-tp5722740p5735905.html
To unsubscribe from Getting profile settings values in a Java class, click here<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5722740&code=c2VyZ3VlaS5jYW1ib3VyQGF0b3MubmV0fDU3MjI3NDB8MTY2NTQxNzk3MQ==>.
NAML<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
________________________________

Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité du groupe Atos ne pourra être engagée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être engagée pour tout dommage résultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.




--
View this message in context: http://maven.40175.n5.nabble.com/Getting-profile-settings-values-in-a-Java-class-tp5722740p5735950.html
Sent from the Maven - Users mailing list archive at Nabble.com.

Re: Getting profile settings values in a Java class

Posted by Ron Wheeler <rw...@artifact-software.com>.
Or the error messages.
Or what the "it" is in "So I have to set it up explicitly every time in 
the POM file. Here is my configuration:"

Ron

On 06/12/2012 3:35 AM, Anders Hammar wrote:
> This is probably difficult to solve without access to the actual
> problematic project.
>
> /Anders
>
>
> On Thu, Dec 6, 2012 at 9:25 AM, Javix <se...@atos.net> wrote:
>
>> I knew those option to desactivate a profile. The problem that I can't
>> figure
>> out how to solve is WHY the same Maven configuration works in one project
>> and not at all in another? By the way, if comment out the line
>>
>> <activation>
>>    <activeByDefault>true</activeByDefault>
>> </activation>
>>
>> and run
>>
>> mvn test -P [profile_to_use]
>>
>> it works fine too. But in another project, no matter the way I use to run
>> Maven tests (commenting out the profile activation lines, running with
>> negation option (![profile_not_to_use], [profile_to_use], it does not work
>> and fails. So I have to set it up explicitly every time in the POM file.
>> Here is my configuration:
>>
>> Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
>> Maven home: C:\Apache\apache-maven-3.0.4
>> Java version: 1.6.0_21, vendor: Sun Microsystems Inc.
>> Java home: C:\Program Files\Java\jdk1.6.0_21\jre
>> Default locale: fr_FR, platform encoding: Cp1252
>> OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"
>>
>> Regards
>>
>>
>>
>> --
>> View this message in context:
>> http://maven.40175.n5.nabble.com/Getting-profile-settings-values-in-a-Java-class-tp5722740p5735884.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Getting profile settings values in a Java class

Posted by Anders Hammar <an...@hammar.net>.
This is probably difficult to solve without access to the actual
problematic project.

/Anders


On Thu, Dec 6, 2012 at 9:25 AM, Javix <se...@atos.net> wrote:

> I knew those option to desactivate a profile. The problem that I can't
> figure
> out how to solve is WHY the same Maven configuration works in one project
> and not at all in another? By the way, if comment out the line
>
> <activation>
>   <activeByDefault>true</activeByDefault>
> </activation>
>
> and run
>
> mvn test -P [profile_to_use]
>
> it works fine too. But in another project, no matter the way I use to run
> Maven tests (commenting out the profile activation lines, running with
> negation option (![profile_not_to_use], [profile_to_use], it does not work
> and fails. So I have to set it up explicitly every time in the POM file.
> Here is my configuration:
>
> Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
> Maven home: C:\Apache\apache-maven-3.0.4
> Java version: 1.6.0_21, vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jdk1.6.0_21\jre
> Default locale: fr_FR, platform encoding: Cp1252
> OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"
>
> Regards
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Getting-profile-settings-values-in-a-Java-class-tp5722740p5735884.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Getting profile settings values in a Java class

Posted by Javix <se...@atos.net>.
I knew those option to desactivate a profile. The problem that I can't figure
out how to solve is WHY the same Maven configuration works in one project
and not at all in another? By the way, if comment out the line 

<activation>
  <activeByDefault>true</activeByDefault>
</activation>

and run

mvn test -P [profile_to_use]

it works fine too. But in another project, no matter the way I use to run
Maven tests (commenting out the profile activation lines, running with
negation option (![profile_not_to_use], [profile_to_use], it does not work
and fails. So I have to set it up explicitly every time in the POM file.
Here is my configuration:

Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: C:\Apache\apache-maven-3.0.4
Java version: 1.6.0_21, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_21\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"

Regards



--
View this message in context: http://maven.40175.n5.nabble.com/Getting-profile-settings-values-in-a-Java-class-tp5722740p5735884.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Getting profile settings values in a Java class

Posted by Anders Hammar <an...@hammar.net>.
> so you need to do ' -P vm,!dev '
>

That is not true. Enabling the "vm" profile will disable the
activeByDefault one ("dev") automatically.

/Anders


>
>
>
>
>
> On 12/5/12 7:53 AM, "Javix" <se...@atos.net> wrote:
>
> >I'm back with a strange behaviour. In a separate project which has
> >profiles
> >defined exactly the same way, passing the option '-P [profile name]' does
> >not work at all, Maven continues to use the default activated profile.
> >Here
> >is a working example:
> >
> ><project xmlns="http://maven.apache.org/POM/4.0.0"
> >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> >http://maven.apache.org/xsd/maven-4.0.0.xsd">
> >       <modelVersion>4.0.0</modelVersion>
> >
> >       <groupId>com.spot.sncf</groupId>
> >       <artifactId>java_cukes</artifactId>
> >       <version>1.0-SNAPSHOT</version>
> >       <packaging>jar</packaging>
> >
> >       <name>java_cukes</name>
> >       <url>http://maven.apache.org</url>
> >       <build>
> >               <plugins>
> >                       <plugin>
> >                               <groupId>org.apache.maven.plugins</groupId>
> >
> <artifactId>maven-compiler-plugin</artifactId>
> >                               <version>2.3.2</version>
> >                               <configuration>
> >                                       <source>1.6</source>
> >                                       <target>1.6</target>
> >                               </configuration>
> >                       </plugin>
> >
> >                       <plugin>
> >                               <groupId>org.apache.maven.plugins</groupId>
> >                               <artifactId>maven-site-plugin</artifactId>
> >                               <version>3.1</version>
> >                               <configuration>
> >                                       <reportPlugins>
> >                                               <plugin>
> >
> <groupId>org.apache.maven.plugins</groupId>
> >
> <artifactId>maven-surefire-report-plugin</artifactId>
> >
> <version>2.4.3</version>
> >                                               </plugin>
> >                                       </reportPlugins>
> >                               </configuration>
> >                       </plugin>
> >               </plugins>
> >
> >               <resources>
> >                       <resource>
> >                               <directory>src/main/resources</directory>
> >                               <filtering>true</filtering>
> >                       </resource>
> >               </resources>
> >       </build>
> >
> >       <properties>
> >
> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> >
> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncodin
> >g>
> >       </properties>
> >
> >       <profiles>
> >               <profile>
> >                       <id>dev</id>
> >                       <activation>
> >                               <activeByDefault>true</activeByDefault>
> >                       </activation>
> >                       <properties>
> >                               <host>http://toto.com</host>
> >                       </properties>
> >               </profile>
> >               <profile>
> >                       <id>vm</id>
> >                       <properties>
> >                               <host>http://yoyo.com</host>
> >                       </properties>
> >               </profile>
> >       </profiles>
> >
> >
> >       <dependencies>
> >               <dependency>
> >                       <groupId>info.cukes</groupId>
> >                       <artifactId>cucumber-picocontainer</artifactId>
> >                       <version>1.1.1</version>
> >                       <scope>test</scope>
> >               </dependency>
> >               <dependency>
> >                       <groupId>info.cukes</groupId>
> >                       <artifactId>cucumber-junit</artifactId>
> >                       <version>1.1.1</version>
> >                       <scope>test</scope>
> >               </dependency>
> >               <dependency>
> >                       <groupId>junit</groupId>
> >                       <artifactId>junit</artifactId>
> >                       <version>4.10</version>
> >                       <scope>test</scope>
> >               </dependency>
> >       </dependencies>
> >
> ></project>
> >
> >Executing
> >
> >mvn test
> >
> >will run the activated default profile (vm).
> >
> >Running
> >
> >mvn test -P vm
> >
> >will run the 'vm' prifile.
> >
> >Using the same but in a different project runs only the activated profile,
> >no matter if I pass -P option.
> >Any idea?
> >
> >Thanks
> >
> >
> >
> >
> >
> >--
> >View this message in context:
> >
> http://maven.40175.n5.nabble.com/Getting-profile-settings-values-in-a-Java
> >-class-tp5722740p5735821.html
> >Sent from the Maven - Users mailing list archive at Nabble.com.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >For additional commands, e-mail: users-help@maven.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Getting profile settings values in a Java class

Posted by "Lyons, Roy" <Ro...@cmegroup.com>.
Taken from 
http://maven.apache.org/guides/introduction/introduction-to-profiles.html

Deactivating a profile

Starting with Maven 2.0.10, one or more profiles can be deactivated using
the command line by prefixing their identifier with either the character
'!' or '-' as shown below:

mvn groupId:artifactId:goal -P !profile-1,!profile-2

This can be used to deactivate profiles marked as activeByDefault or
profiles that would otherwise be activated through their activation config.



so you need to do ' -P vm,!dev '





On 12/5/12 7:53 AM, "Javix" <se...@atos.net> wrote:

>I'm back with a strange behaviour. In a separate project which has
>profiles
>defined exactly the same way, passing the option '-P [profile name]' does
>not work at all, Maven continues to use the default activated profile.
>Here
>is a working example:
>
><project xmlns="http://maven.apache.org/POM/4.0.0"
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>http://maven.apache.org/xsd/maven-4.0.0.xsd">
>	<modelVersion>4.0.0</modelVersion>
>
>	<groupId>com.spot.sncf</groupId>
>	<artifactId>java_cukes</artifactId>
>	<version>1.0-SNAPSHOT</version>
>	<packaging>jar</packaging>
>
>	<name>java_cukes</name>
>	<url>http://maven.apache.org</url>
>	<build>
>		<plugins>
>			<plugin>
>				<groupId>org.apache.maven.plugins</groupId>
>				<artifactId>maven-compiler-plugin</artifactId>
>				<version>2.3.2</version>
>				<configuration>
>					<source>1.6</source>
>					<target>1.6</target>
>				</configuration>
>			</plugin>
>
>			<plugin>
>				<groupId>org.apache.maven.plugins</groupId>
>				<artifactId>maven-site-plugin</artifactId>
>				<version>3.1</version>
>				<configuration>
>					<reportPlugins>
>						<plugin>
>							<groupId>org.apache.maven.plugins</groupId>
>							<artifactId>maven-surefire-report-plugin</artifactId>
>							<version>2.4.3</version>
>						</plugin>
>					</reportPlugins>
>				</configuration>
>			</plugin>
>		</plugins>
>
>		<resources>
>			<resource>
>				<directory>src/main/resources</directory>
>				<filtering>true</filtering>
>			</resource>
>		</resources>
>	</build>
>	
>	<properties>
>		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncodin
>g>
>	</properties>
>
>	<profiles>
>		<profile>
>			<id>dev</id>
>			<activation>
>				<activeByDefault>true</activeByDefault>
>			</activation>
>			<properties>
>				<host>http://toto.com</host>
>			</properties>
>		</profile>
>		<profile>
>			<id>vm</id>
>			<properties>
>				<host>http://yoyo.com</host>
>			</properties>
>		</profile>
>	</profiles>
>
>
>	<dependencies>
>		<dependency>
>			<groupId>info.cukes</groupId>
>			<artifactId>cucumber-picocontainer</artifactId>
>			<version>1.1.1</version>
>			<scope>test</scope>
>		</dependency>
>		<dependency>
>			<groupId>info.cukes</groupId>
>			<artifactId>cucumber-junit</artifactId>
>			<version>1.1.1</version>
>			<scope>test</scope>
>		</dependency>
>		<dependency>
>			<groupId>junit</groupId>
>			<artifactId>junit</artifactId>
>			<version>4.10</version>
>			<scope>test</scope>
>		</dependency>
>	</dependencies>
>
></project>
>
>Executing
>
>mvn test
>
>will run the activated default profile (vm).
>
>Running
>
>mvn test -P vm
>
>will run the 'vm' prifile.
>
>Using the same but in a different project runs only the activated profile,
>no matter if I pass -P option.
>Any idea?
>
>Thanks
>
>
>
>
>
>--
>View this message in context:
>http://maven.40175.n5.nabble.com/Getting-profile-settings-values-in-a-Java
>-class-tp5722740p5735821.html
>Sent from the Maven - Users mailing list archive at Nabble.com.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>For additional commands, e-mail: users-help@maven.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org