Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-4933

With a resource directory as . maven raise an java.lang.StringIndexOutOfBoundsException:217

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.1
    • 3.0.2
    • None
    • None

    Description

      I exexute a release:prepare-with-pom
      I debug this execution and I found when the directory is equal to basedir.getPath() an exception is raised.

      And I have this definition in my pom.xml
      <resource>
      <directory>.</directory>
      <includes>
      <include>plugin.xml</include>
      <include>plugin.properties</include>
      <include>icons/**</include>
      </includes>
      </resource>

      Trace:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.1.1:prepare-with-pom (default-cli) on project servicelayer: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.1.1:prepare-with-pom failed: String index out of range: -1 -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.1.1:prepare-with-pom (default-cli) on project servicelayer: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.1.1:prepare-with-pom failed: String index out of range: -1
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:140)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:451)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:188)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:134)
      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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
      Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.1.1:prepare-with-pom failed: String index out of range: -1
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:116)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:195)
      ... 19 more
      Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      at java.lang.String.substring(String.java:1937)
      at java.lang.String.substring(String.java:1904)
      at org.apache.maven.project.path.DefaultPathTranslator.unalignFromBaseDirectory(DefaultPathTranslator.java:217)
      at org.apache.maven.project.path.DefaultPathTranslator.unalignFromBaseDirectory(DefaultPathTranslator.java:181)
      at org.apache.maven.shared.release.phase.GenerateReleasePomsPhase.createReleaseModel(GenerateReleasePomsPhase.java:274)
      at org.apache.maven.shared.release.phase.GenerateReleasePomsPhase.generateReleasePom(GenerateReleasePomsPhase.java:141)
      at org.apache.maven.shared.release.phase.GenerateReleasePomsPhase.generateReleasePoms(GenerateReleasePomsPhase.java:129)
      at org.apache.maven.shared.release.phase.GenerateReleasePomsPhase.execute(GenerateReleasePomsPhase.java:105)
      at org.apache.maven.shared.release.phase.GenerateReleasePomsPhase.execute(GenerateReleasePomsPhase.java:92)
      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:279)
      at org.apache.maven.plugins.release.PrepareWithPomReleaseMojo.execute(PrepareWithPomReleaseMojo.java:47)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
      ... 20 more
      [ERROR]
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR]

      Attachments

        Activity

          People

            bentmann Benjamin Bentmann
            chomats Stephane Chomat
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: