Maven Invoker Plugin not detecting failed test - maven

As part of a root parent pom project, several integration tests have been added to test it on sample projects.
The structure of the project folder is as following:
-root-maven-parent-project
|- src
| |-it
| |-sample-project-test1
| |-sample-project-test2
| |-sample-project-test3
| |-settings.xml
|- pom.xml
The main issue is: although the build of sample-project-test2 is wrongly failing (it should not), the build is SUCCESSFUL for the Invoker plugin and the overall build does not fail.
Here is the concerned maven-invoker-plugin configuration:
<profile>
<id>it-tests</id>
<build>
<plugins>
<!-- Integration tests configuration -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<streamLogs>true</streamLogs>
<goals>
<goal>clean</goal>
<goal>generate-sources</goal>
</goals>
<settingsFile>src/it/settings.xml</settingsFile>
<failIfNoProjects>true</failIfNoProjects>
</configuration>
<executions>
<execution>
<id>integration-test-release</id>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<cloneProjectsTo>${project.build.directory}/its/sample-project-test1</cloneProjectsTo>
<pom>src/it/sample-project-test1/pom.xml</pom>
<properties>
<scmBranch>release-something</scmBranch>
</properties>
</configuration>
</execution>
<execution>
<id>integration-test-hotfix</id>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<cloneProjectsTo>${project.build.directory}/its/sample-project-test2</cloneProjectsTo>
<pom>src/it/sample-project-test2/pom.xml</pom>
<properties>
<scmBranch>hotfix-something</scmBranch>
</properties>
</configuration>
</execution>
<execution>
<id>integration-test-master</id>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<cloneProjectsTo>${project.build.directory}/its/sample-project-test3</cloneProjectsTo>
<pom>src/it/sample-project-test3/pom.xml</pom>
<properties>
<scmBranch>master</scmBranch>
</properties>
</configuration>
</execution>
</plugin>
</plugins>
</build>
</profile>
As you can see, multiple executions are configured because each execution would need its own properties. Each execution is also pointing at its own integration test project and pom.
The build is clearly failing for a specific execution:
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 2.337 s
[INFO] [INFO] Finished at: 2017-07-04T17:35:49+02:00
[INFO] [INFO] Final Memory: 12M/220M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-snapshot-management) on project cmp-sample-project-test2: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
[INFO] [ERROR]
[INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR]
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO] pom.xml .......................................... FAILED (4.1 s)
[INFO] The build exited with code 1. See C:\data\git-repositories\root-maven-parent\target\its\sample-project-test2\build.log for details.
However, at the bottom of the build we see that the verify goal of the maven-invoker-plugin aggregated the results, flagged the concerned test as Passed and made the build SUCCESS:
[INFO]
[INFO] --- maven-invoker-plugin:3.0.0:verify (integration-test-release) # root-maven-parent ---
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO] Passed: 1, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO]
[INFO] --- maven-invoker-plugin:3.0.0:verify (integration-test-hotfix) # root-maven-parent ---
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO] Passed: 1, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO]
[INFO] --- maven-invoker-plugin:3.0.0:verify (integration-test-master) # root-maven-parent ---
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO] Passed: 1, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
Moreover, by only running the failing test from command line as:
mvn invoker:integration-test#integration-test-hotfix invoker:verify -Pit-tests
The sub-build of the test project fails, the output is correctly marked as Failed in the test summary, and the build is correctly ending with FAILURE.
Question: why when executing multiple integration tests using the maven-invoker-plugin, although a test is failed, it is marked as Passed in the test summary and the build does not fail, while running only the isolated test everything fails correctly?
Note: no invoker property file is used.

Issue solved with the following explanation, although I think something could be improved in the behavior of the plugin (see below).
The whole maven-invoker-plugin was reduced to the following configuration:
<profile>
<id>it-tests</id>
<build>
<plugins>
<!-- Integration tests configuration -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<streamLogs>true</streamLogs>
<goals>
<goal>clean</goal>
<goal>generate-sources</goal>
</goals>
<settingsFile>src/it/settings.xml</settingsFile>
<failIfNoProjects>true</failIfNoProjects>
<cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo>
</configuration>
<executions>
<execution>
<id>integration-test-release</id>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Basically: only one plugin execution, instead of an execution per test, which indeed was verbose and non scalable, but forced by the need of having different values for the same property in each integration test. Apparently, this is not possible via pom configuration and only achievable - unless I am not mistaken - via a test.properties file.
Hence, as a complement to the configuration above, I added in each and every integration test project folder a test.properties file with the following content e.g.:
scmBranch=master
De facto replacing what in the pom.xml file was (as part of an execution of the maven-invoker-plugin:
<properties>
<scmBranch>master</scmBranch>
</properties>
This mechanism (single execution of the plugin + test properties file per test folder) fixed the issue, allowing the build to have multiple integration tests each with its own different value for the same property. Hopefully this solution may help troubleshooting similar issues.
Here is the final result from the build correctly aggregating tests and effectively respecting their sub-build output (while before the build was generating 6 Build Summary of Passed: 1 each time, although not correct).
[INFO] --- maven-invoker-plugin:3.0.0:verify (pom-integration-test) # root-maven-parent ---
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO] Passed: 6, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
However, some questions remain:
Without using the test.properties file, how to achieve the same via pom.xml configuration? Normally, it should only be an alternative, not a mandatory and only possible solution. That's why this is rather a uncomplete feature (a bug?) to me.
Having multiple execution of the plugin results in test summaries at the end of the build which correctly follow the executions order, the number of tests executed (always 1 per execution, in this case), but apparently do not reflect the effective result of each sub-build. Why? This is rather a bug or a misbehavior of the plugin due to an unexpected usage of it, perhaps.

use this configuration :-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0</version>
<configuration>
<rules>
<banDuplicateClasses>
<findAllDuplicates>true</findAllDuplicates>
</banDuplicateClasses>
</rules>
<fail>false</fail>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>1.0-alpha-1</version>
</dependency>
</dependencies>
</plugin>
for more refer this link :
http://maven.apache.org/enforcer/maven-enforcer-plugin/

Related

How to run Spek tests with Maven?

I'm trying to run Spek tests with Maven. I have set up maven like this:
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<configuration/>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Additionally I have a few Spek tests in src/test/kotlin. I can run these fine within the IDE, but when I run mvn test they are completely ignored by the surefire plugin (it reports 0 tests being run). Is it possible to run Spek tests with maven and if so, how would this be set up? I cannot find anything about it on the spek homepage.
I could reproduce your issue with a small sample project, that you can find on GitLab.com.
If you run mvn clean test, surefire won't find any tests:
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # spek-maven-sample ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.074 s
[INFO] Finished at: 2016-07-27T00:49:14+02:00
[INFO] Final Memory: 36M/363M
[INFO] ------------------------------------------------------------------------
This can be circumvented by explicitly including test specs in the Surefire plugin. Say, all your specs are named *Spec.*, then explicitly configuring surefire in your pom.xml:
<build>
<plugins>
<!-- other build plugins like the kotlin-maven-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<includes>
<include>**/*Spec.*</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
will lead to executing tests
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # spek-maven-sample ---
[INFO] Surefire report directory: C:\Dev\IDEA\spek-test\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running NonsenseTestableSpec
Proof that 'should return true' ran
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.077 sec
Results :
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.335 s
[INFO] Finished at: 2016-07-27T01:02:12+02:00
[INFO] Final Memory: 26M/363M
[INFO] ------------------------------------------------------------------------
You can find the full working example on the branch "explicit-surefire-config" of the mentioned repository.

Properly binding maven exec plugin to test phase

In a Maven project I use maven-exec-plugin to launch my Grunt tests. It goes like this:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>cmd</executable>
<workingDirectory>${project.basedir}/src/main/webapp</workingDirectory>
<arguments>
<argument>/C</argument>
<argument>grunt --no-color test</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
With that I can run mvn test and my grunt test task will be executed: if the tests pass, the maven build pass and if the tests fail the maven build fail. When some tests fail I have the following output:
............................................. 1 failing
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.496s
[INFO] Finished at: ** ** ** **:**:** CEST ****
[INFO] Final Memory: *M/*M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default) on project *****: Command execution failed. Process exited with an error: 6 (Exit value: 6) -> [Help 1]
I would like to know if it is possible to have the 'usual' maven output for failing tests. Something like: Build failure, there are failing tests.
Thanks
Not easily. The build failure message shows the exception thrown by the failing plugin; in exec-maven-plugin's case, that will only ever be the report of the exit code. It won't consider anything else in the command's behaviour.
If you were determined, you could rewrite or extend exec-maven-plugin, or perhaps write something similar in Groovy to throw an exception with a more specific message.
(A grunt-maven-plugin exists, but it also delegates to exec-maven-plugin.)

How to echo in Maven without Antrun plugin?

How can I print to the console while executing a mvn command (in a phase/goal), but not using Maven Antrun plugin?
Why I reject Antrun solutions:
The overhead in code to print a single message is massiv.
The output is no formated like maven output
I cannot attach a severity to the message (e.g. DEBUG, INFO, ERROR, etc)
Currently an Ant-echo looks like this (see line with "hello world"):
[INFO] --- maven-antrun-plugin:1.7:run (default) # ejpd-alertmanager-ear ---
[WARNING] Parameter tasks is deprecated, use target instead
[INFO] Executing tasks
main:
[echo] hello world
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
However, I expect it to look like this (see line with "hello world").
[INFO] --- maven-antrun-plugin:1.7:run (default) # ejpd-alertmanager-ear ---
[WARNING] Parameter tasks is deprecated, use target instead
[INFO] Executing tasks
[INFO] hello world
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
I'm positive, I am missing something here, since I cannot be the first to raise this demand. Thank you for any smart hint.
You should try the Maven Echo plugin:
<plugin>
<groupId>com.soebes.maven.plugins</groupId>
<artifactId>maven-echo-plugin</artifactId>
<version>0.1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>echo</goal>
</goals>
</execution>
</executions>
<configuration>
<echos>
<echo>This is the Text which will be printed out.</echo>
</echos>
</configuration>
</plugin>
Or furthermore take a deeper look into the integration test of the plugin.
which is available via Maven Central. BTW: If you have further requests/improvements just file in an issue.
You can use Björn Ekryd's Echo Maven Plugin, which is published in Maven Central.
It has a normal amount of XML required for a Maven plugin, the output is formatted like the other Maven log lines, and you can assign a severity level to your message (default is INFO).
<plugin>
<groupId>com.github.ekryd.echo-maven-plugin</groupId>
<artifactId>echo-maven-plugin</artifactId>
<version>1.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>echo</goal>
</goals>
<configuration>
<message>war has changed</message>
<level>INFO</level>
</configuration>
</execution>
</executions>
</plugin>
[INFO] --- maven-war-plugin:2.4:war (default-war) # mymodule ---
[INFO] Packaging webapp
[INFO] Processing war project
[INFO]
[INFO] --- echo-maven-plugin:1.2.0:echo (default) # mymodule ---
[INFO] war has changed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
Also, this plugin has 95% code coverage, which is pretty cool.
You can use Groovy Maven Plugin for this.
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
log.info('Test message: {}', 'Hello, World!')
</source>
</configuration>
</execution>
</executions>
</plugin>
The configuration above will produce the following output:
[INFO] Test message: Hello, World!
I haven't tried this myself but there is a plugin here which may help:
http://code.google.com/p/maven-echo-plugin/

How can I specify an ant target to run during the release:prepare goal?

When using the maven release plugin I want to do some pre-work (via an ant tast) as part of the release build with the assurance that the same code base is used (so no commits sneak in between). I have an ant task that I want to call to do this, but I'm having the following issue:
inside my pom file:
<configuration>
<preparationGoals>antrun:run -Dtarget=${antTaskJarBuildXML} clean verify</preparationGoals>
</configuration>
where ${antTaskJarBuildXML} is:
<target><ant antfile=\"../build.xml\" target=\"iv_dependency_build\" /></target>
When I run release:perform this is the log:
...
[INFO] Not generating release POMs
[INFO] Executing goals 'antrun:run -Dtarget="<target><ant antfile=\"../build.xml\" target=\"iv_dependency_build\" /></target>" clean verify'...
[WARNING] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] [INFO] Scanning for projects...
[INFO] [WARNING]
[INFO] [WARNING] Some problems were encountered while building the effective model for com.xactsites:iv:war:12.12.4.9
[INFO] [WARNING] The expression ${version} is deprecated. Please use ${project.version} instead.
[INFO] [WARNING]
[INFO] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[INFO] [WARNING]
[INFO] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[INFO] [WARNING]
[INFO] [INFO]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Building iv 12.12.4.9
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [WARNING] The artifact javax.xml:jaxrpc:jar:1.1 has been relocated to javax.xml:jaxrpc-api:jar:1.1
[INFO] [INFO]
[INFO] [INFO] --- maven-antrun-plugin:1.7:run (default-cli) # iv ---
[INFO] [INFO] No ant target defined - SKIPPED
[INFO] [INFO]
[INFO] [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # iv ---
[INFO] [INFO] Deleting C:\dev\apps\iv\target
[INFO] [INFO]
...
And as shown in the log, I am told that no target is specified. I followed what I understood from the ant run documentation
Am I missing something in how to pass in the target name?
Is this the best approach?
Is it a matter of escaping that I am missing? I'm on windows and this is the actual value defined for the xml (${antTaskJarBuildXML}):
"<target><ant antfile=\"../build.xml\" target=\"iv_dependency_build\" /></target>"
EDIT
#carlspring has given some great feedback (+1 on his answer), however, due to the nature of the problem where not everything is mavenized I couldn't get this working. Maven is expecting to be in control of the whole release process, but I need to perform an ant task (which creates dependencies needed for the build in question) beforehand. I also need to be assured that this prework task and the regular build are built against the same git tag/hash. My current solution is to sequentially do the steps that the release plugin would perform as discussed here. Through this I can create a git tag then do the maven build against that same git tag. If there are any better ideas out there please contribute!
My suggestions would be for you to define a profile and have your ant-run definition in it.
The release plugin forks, meaning your command-line args will be ignored.
UPDATE:
Try this:
<?xml version="1.0" encoding="UTF-8"?>
<project ...>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
<executions>
<execution>
<id>execute-prepare</id>
<!-- Set up your Ant stuff here -->
<goals>
<goal>prepare</goal>
</goals>
<configuration>
<!-- If you have args specific for your release, put them here: -->
<arguments>-Pant-run-release</arguments>
<releaseProfiles>ant-run-release</releaseProfiles>
<mavenExecutorId>forked-path</mavenExecutorId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>ant-run-release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>execute-something</id>
<!-- Set up your Ant stuff here -->
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

Script to automate the maven release process with SVN source

I am usig a batch script to release my projetcs, it works fine for my common project, but when it comes for the actual main project which got a dependency to the common project, mvn release prepare is failing(Error msg -The svn tag command failed svn: Path(branch path) does not exists in revision# while doing mvn release:prepare).
Batch scrip to release the passed projetcs in sequence
FOR %%G IN (common-utilities-project,myProject) DO (
svn checkout svn://server1/root/%%G/branches/br1
cd br1
call mvn clean
call mvn release:clean
if errorlevel 1 goto failed
call mvn versions:use-next-versions -DgenerateBackupPoms=false -Dincludes=com.commom:common-utilities-project scm:checkin deploy -Dmessage="Updated dependencies for release" -DperformRelease=true
if errorlevel 1 goto failed
echo.| call mvn release:prepare
if errorlevel 1 goto failed
call mvn release:perform -DreleaseProfiles=deploy
if errorlevel 1 goto failed
mvn versions:use-next-snapshots -DallowSnapshots=true -DgenerateBackupPoms=false -Dincludes=com.commom:common-utilities-project scm:checkin deploy -Dmessage="Updated dependencies to SNAPSHOT for next developement"
if errorlevel 1 goto failed
cd..
RD /S/Q br1
)
:failed
echo ******** Unable to do release********
pause
I am using following plugins.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<goal>analyze-report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>classes-jar</id>
<goals><goal>jar</goal></goals>
<phase>package</phase>
<configuration>
<classifier>classes</classifier>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<id>build-exploded-war</id>
<phase>generate-resources</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<useCache>true</useCache>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.1.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-maven3-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<ajdtVersion>none</ajdtVersion>
</configuration>
</plugin>
My POM file got the following SCM tag in it.
<scm>
<developerConnection>scm:svn:svn://server1/root/myProject/branches/br1</developerConnection>
<connection>scm:svn:svn://server1/root/myProject/branches/br1</connection>
<url>http://server1</url>
</scm>
Actual error details
...................................A lot of logs with all success......................................
[INFO] [INFO] myProject [Project Module] .............................. SUCCESS [0.140s]
[INFO] [INFO] myProject [WAR module] .................................. SUCCESS [39.043s]
[INFO] [INFO] myProject [EAR module] .................................. SUCCESS [5.874s]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 45.198s
[INFO] [INFO] Finished at: Mon Nov 26 21:59:10 EST 2012
[INFO] [INFO] Final Memory: 26M/63M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] Checking in modified POMs...
[INFO] Executing: cmd.exe /X /C "svn --non-interactive commit --file C:\DOCUME~1\u12132\LOCALS~1\Temp\maven-scm-593417731.commit -
-targets C:\DOCUME~1\u12132\LOCALS~1\Temp\maven-scm-5681031475211993765-targets"
[INFO] Working directory: D:\SVN\br1
[INFO] Tagging release with the label myProject-9.9.9...
[INFO] Executing: cmd.exe /X /C "svn --non-interactive copy --file C:\DOCUME~1\u12132\LOCALS~1\Temp\maven-scm-917421157.commit --r
evision 33929 svn://server1/root/myProject/branches/br1 svn://server1/root/myProject/tags/myProject-9.9.9"
[INFO] Working directory: D:\SVN\br1
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] myProject [Project Module] .............................. FAILURE [48.760s]
[INFO] myProject [WAR module] .................................. SKIPPED
[INFO] myProject [EAR module] .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 49.073s
[INFO] Finished at: Mon Nov 26 21:59:11 EST 2012
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project myProject: Unable to t
ag SCM
[ERROR] Provider message:
[ERROR] The svn tag command failed.
[ERROR] Command output:
[ERROR] svn: Path 'svn://server1/root/myProject/branches/br1' does not exist in revision 33929
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
******** Unable to do release********
Press any key to continue . . .
Any comments/idea to improve this script ?
Is the branch given in your SCM tag correct?
scm:svn:svn://server1/root/myProject/branches/br1
Something the release plugin seems to mess it up. I've had to change it manually some times back to a sensible value (depending of the branch from which you do your release).

Resources