maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <Joerg.Schai...@scalaris.com>
Subject Re: Setting user property via cmd using group-id & artifact-id
Date Tue, 17 Dec 2013 10:43:07 GMT
Cemo wrote:

> On 17 December 2013 11:45, Stephen Connolly
> <stephen.alan.connolly@gmail.com
>> wrote:
> 
>> Nope no feature request. It would be rejected.
> 
> 
> Actually It would be nice to have a configuration like this:
> 
>       <profile>
>          <id>disable-test</id>
>          <activation>
>             <property>
>                <name>${pom.groupId}.
${pom.artifactId}.maven.test.skip</name>
>             </property>
>          </activation>
>          <properties>
>             <maven.test.skip>true</maven.test.skip>
>          </properties>
>       </profile>
> 
> What do you think about this?  :)

Wrong attempt. As Stephan said, *you* have to setup your POMs to support 
such a feature. And you don't even need profiles, just a shared parent, 
where you add in the configuration section of the surefire plugin

=== shared parent pom ======== %< ======
 <build>
 ...
   <pluginManagement>
   ...
     <plugin>
       <artifactId>maven-surefire-plugin</artifactId>
       ...
       <configuration>
         <skipTests>${local.skip.tests}</skipTests>
         ...
       </configuration>
     </plugin>
   ...
   </pluginManagement>
 ...
 </build>
 ...
 <properties>
   <local.skip.tests>${maven.test.skip.exec}</local.skip.tests>
   ...
 </properties>
=== shared parent pom ======== %< ======

and in the individual POMs of the projects:

=== project pom ======== %< =========
 <groupId>group-id</groupId>
 <artifactId>artifact-id</artifactId>
 ...
 <properties>
   <group-id.artifact-
id.skip.tests.skip.tests>${maven.test.skip.exec}</group-id.artifact-
id.skip.tests.skip.tests>
   <local.skip.tests>${group-id.artifact-id.skip.tests}</local.skip.tests>
   ...
 </properties>
=== project pom ======== %< =========

The tests for any project containing the last two lines can be disabled 
individually now using -Dgroup-id.artifact-id.skip.tests=true on the command 
line. Without the system property or if the properties are not defined in 
the project at all, the test execution depends on the value of 
maven.test.skip.exec - just as normal.

So, it is just as Stephan said, with a bit of own XML glue code, you can do 
what you want, but don't expect ever that Maven works like this OOTB.

Cheers,
Jörg



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


Mime
View raw message