Maven release: prepare to skip test jar

I am using maven ver. 3 with the following plugin to generate a separate * .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 the configuration of my plugin is as follows:

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

Creating test classes in a separate bank works fine as long as I don't use:

 maven clean deploy 

When I do an exemption, a test gang is not created:

 -Dresume=false release:prepare release:perform 

Output to exit:

 ... [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 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 create my test jar during release? Why is this missing?

EDIT

I found that this problem only occurs when I have an active release profile. I can not find this profile in any parent pump. Where is he from? From the definitions of the maven-release plugin?

RESOLVED

I found the release profile 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 now everything is working fine.

+4
source share

Source: https://habr.com/ru/post/1490846/


All Articles