0

我正在使用批处理脚本来发布我的项目,它适用于我的公共项目,但是当涉及到依赖于公共项目的实际主项目时,mvn release prepare 失败(错误消息 - svn tag 命令失败的 svn:路径(分支路径)在做 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>

我的 POM 文件中包含以下 SCM 标签。

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

有什么意见/想法可以改进这个脚本吗?

4

1 回答 1

0

您的 SCM 标签中给出的分支是否正确?

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

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

于 2013-08-15T07:55:57.297 回答