I`m using maven ver. 3 with following plugin to generate separated *.jar file with tests.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>core-tests</id>
<phase>package</phase>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
and my release plugin configuration looks following:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-8</version>
<configuration>
<releaseProfiles>release</releaseProfiles>
<preparationGoals>clean install</preparationGoals>
<generateReleasePoms>false</generateReleasePoms>
<scmCommentPrefix>
release plugin -
</scmCommentPrefix>
</configuration>
</plugin>
Generating test classes in separated jar works fine until I use:
maven clean deploy
When I`m doing release my test-jar is not created:
-Dresume=false release:prepare release:perform
Release output:
...
[INFO] [INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] [INFO] Not compiling test sources
[INFO] [INFO] [surefire:test {execution: default-test}]
[INFO] [INFO] Tests are skipped.
[INFO] [INFO] [jar:jar {execution: default-jar}]
[INFO] [INFO] Building jar: /home/tomcat/hudson_home/jobs/project-core/workspace/target/core-1.2-SNAPSHOT.jar
[INFO] [INFO] [jar:test-jar {execution: core-tests}]
[INFO] [INFO] Skipping packaging of the test-jar
...
I alos tried to use DskipTests but also without success
-Dresume=false -Darguments="-DskipTests" release:prepare release:perform -Prelease
or
-Dresume=false -Darguments="-Dmaven.test.skip.exec=true" release:prepare release:perform -Prelease
How can I generate my test-jar during release? Why it is skipped?
EDIT
I found that this problem occures only when I have active release profile. I can`t find this profile in any parent pom. Where it comes from? From maven-release-plugin definitions?
RESOLVED
I found profile release on hudsons .m2/settings.xml:
<profile>
<id>release</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<username>*****</username>
<password>*****</password>
<skipTests>true</skipTests>
<maven.test.skip>true</maven.test.skip>
</properties>
</profile>
I just needed to remove maven.test.skip and everything works fine now.