2

这是我在使用 maven 发布插件进行发布时遇到的问题的摘录。我认为这与显示在 reactorProjects 中的 basedir 大写/小写 c:\ 有关,但我不知道如何修复它。我的 Maven 版本是:

Apache Maven 2.2.1 (r801777; 2009-08-06 16:16:01-0300)
Java version: 1.6.0_13
Java home: c:\Java\jdk1.6.0_13x86\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows vista" version: "6.1" arch: "x86" Family: "windows"

这是构建失败的部分:

    These will use the artifact files already in the core ClassRealm instead, to allow them to be included in PluginDescriptor.getArtifacts().


    [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-release-plugin:2.0:prepare' -->
    [DEBUG]   (f) addSchema = true
    [DEBUG]   (f) allowReleasePluginSnapshot = false
    [DEBUG]   (f) allowTimestampedSnapshots = false
    [DEBUG]   (f) autoVersionSubmodules = true
    [DEBUG]   (s) basedir = c:\projects\2.1.0.10
    [DEBUG]   (f) commitByProject = false
    [DEBUG]   (f) dryRun = false
    [DEBUG]   (f) generateReleasePoms = false
    [DEBUG]   (f) javaHome = c:\Java\jdk1.6.0_13x86\jre
    [DEBUG]   (f) localCheckout = false
    [DEBUG]   (f) mavenExecutorId = invoker
    [DEBUG]   (f) mavenHome = C:\apache-maven-2.2.1
    [DEBUG]   (f) preparationGoals = clean install
    [DEBUG]   (f) project = MavenProject: com.gridpoint.consumer:consumer-project:2.1.0.11-SNAPSHOT @ c:\projects\2.1.0.10\pom.xml
    [DEBUG]   (f) reactorProjects = [MavenProject: com.gridpoint.consumer:consumer-project:2.1.0.11-SNAPSHOT @ c:\projects\2.1.0.10\pom.xml, MavenProject: com.gridpoint.consumer:consumer-common:2.1.0.11-SNAPSHOT @ C:\pro
    .1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\model\pom.xml, MavenProject: com.gridpoint.consumer.model:server-model:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\model\server-model\pom.xml, MavenProject: com.gridpoint.consumer
    Project: com.gridpoint.consumer.model:client-model:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\model\client-model\pom.xml, MavenProject: com.gridpoint.consumer:xcel-services:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\xcel
    1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\xcel-services\gpla-client\pom.xml, MavenProject: com.gridpoint.consumer.xcel-services:afsl-client:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\xcel-services\afsl-client\pom.xml, Mav
    ojects\2.1.0.10\xcel-services\meter-data\pom.xml, MavenProject: com.gridpoint.consumer.xcel-services:service-impl:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\xcel-services\service-impl\pom.xml, MavenProject: com.gridpoi
    ifications\pom.xml, MavenProject: com.gridpoint.consumer:flex-deps:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\flex-deps\pom.xml, MavenProject: com.gridpoint.consumer.flex-deps:fxcomponents:2.1.0.11-SNAPSHOT @ C:\projec
    x-deps:lixar-controls:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\flex-deps\lixar-controls\pom.xml, MavenProject: com.gridpoint.consumer.flex-deps:patches-from-flex-sdk-3_5:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\flex-
    ps:papervision3d:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\flex-deps\papervision3d\pom.xml, MavenProject: com.gridpoint.consumer.flex-deps:efflex-controls:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\flex-deps\efflex-cont
    \2.1.0.10\flex-deps\pollensoft-cairngorm\pom.xml, MavenProject: com.gridpoint.consumer.flex-deps:dependency-provider:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\flex-deps\dependency-provider\pom.xml, MavenProject: com.g
    om.xml, MavenProject: com.gridpoint.consumer:consumer-portal:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\consumer-portal\pom.xml, MavenProject: com.gridpoint.consumer:administration:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0
    .0.11-SNAPSHOT @ C:\projects\2.1.0.10\xcel-sso-sample\pom.xml, MavenProject: com.gridpoint.consumer:delete-test-account:2.1.0.11-SNAPSHOT @ C:\projects\2.1.0.10\delete-test-account\pom.xml]
    [DEBUG]   (f) remoteTagging = true
    [DEBUG]   (f) resume = true
    [DEBUG]   (f) scmCommentPrefix = [Release 2.1.0.11:GPXLOAM-4531]
    [DEBUG]   (f) session = org.apache.maven.execution.MavenSession@8822a0
    [DEBUG]   (f) settings = org.apache.maven.settings.Settings@18e9adf
    [DEBUG]   (f) updateDependencies = true
    [DEBUG]   (f) useEditMode = false
    [DEBUG] -- end configuration --
    [INFO] [release:prepare {execution: default-cli}]
    [INFO] Resuming release from phase 'rewrite-poms-for-release'
    [INFO] Transforming 'GPN XCel OAM'...
    [INFO] ------------------------------------------------------------------------
    [ERROR] FATAL ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] String index out of range: -1
    [INFO] ------------------------------------------------------------------------
    [DEBUG] Trace
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
            at java.lang.String.substring(String.java:1938)
            at org.apache.maven.shared.release.util.ReleaseUtil.getCommonBasedir(ReleaseUtil.java:206)
            at org.apache.maven.shared.release.util.ReleaseUtil.getCommonBasedir(ReleaseUtil.java:177)
            at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformDocument(AbstractRewritePomsPhase.java:303)
            at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformProject(AbstractRewritePomsPhase.java:208)
            at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transform(AbstractRewritePomsPhase.java:114)
            at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.execute(AbstractRewritePomsPhase.java:97)
            at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:203)
            at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:140)
            at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:103)
            at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:211)
            at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:181)
            at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
            at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
            at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
            at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
            at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 13 seconds
    [INFO] Finished at: Fri Apr 01 15:19:39 ADT 2011
    [INFO] Final Memory: 39M/508M
    [INFO] --------

----------------------------------------------------------------

有什么想法吗?

4

2 回答 2

5

奇怪的是,对 maven-release-plugin 2.1 的更新解决了这个问题。

于 2011-04-04T14:06:28.887 回答
1

我认为这是您对 basedir 的定义 - 您需要以 Java 样式输入它,使用 '/' 而不是 '\'。这可确保您的 Maven 构建将跨平台工作。

查看相关源的grep 代码

if ( !basedir.endsWith( "/" ) )
{
  basedir = basedir.substring( 0, basedir.lastIndexOf( "/" ) );
}
于 2011-04-01T20:27:16.343 回答