使用SVN源代码自动化maven发布过程的脚本

使用SVN源代码自动化maven发布过程的脚本,maven,maven-3,maven-plugin,maven-release-plugin,Maven,Maven 3,Maven Plugin,Maven Release Plugin,我正在使用批处理脚本来发布我的项目,它对我的公共项目运行良好,但是当涉及到依赖于公共项目的实际主项目时,mvn release prepare失败(错误消息-svn tag命令failed svn:Path(分支路径)在执行mvn release:prepare时在修订版中不存在) 按顺序发布已通过项目的批处理凭单 FOR %%G IN (common-utilities-project,myProject) DO ( svn checkout svn://server1/root/%%G/br

我正在使用批处理脚本来发布我的项目,它对我的公共项目运行良好,但是当涉及到依赖于公共项目的实际主项目时,mvn release prepare失败(错误消息-svn tag命令failed svn:Path(分支路径)在执行mvn release:prepare时在修订版中不存在)

按顺序发布已通过项目的批处理凭单

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
我正在使用以下插件

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

有任何改进此脚本的意见/想法吗?

SCM标记中给出的分支是否正确

scm:svn:svn://server1/root/myProject/branches/br1


发布插件似乎把事情搞砸了。有时我不得不手动将其更改回合理的值(取决于发布版本的分支)。

您能否显示完整的输出,因为您错过了很多东西……您使用的是哪个版本的maven release插件?您正在使用旧的插件版本等。能否显示完整的pom.xml文件?
<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>
 ...................................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 . . .