mvn idea:idea fails with StringIndexOutOfBoundsException (toRelative method) 
when adding resource to base project
-----------------------------------------------------------------------------------------------------------------

                 Key: MIDEA-75
                 URL: http://jira.codehaus.org/browse/MIDEA-75
             Project: Maven 2.x Idea Plugin
          Issue Type: Bug
    Affects Versions: 2.0
            Reporter: Silvestrov Ilya
         Attachments: ideaPluginBug.zip

I want a base project to handle special resource which is located in not 
default location.
Example: I want all my projects to pack file history.txt located in project 
basedir into jar.

So, this resource is mentioned in parent project:

<build>
    <resources>
      <resource>
        <directory>${basedir}</directory>
        <includes>
          <include>history.txt</include>
        </includes>
      </resource>
    </resources>
</build>

When I package child project it works well. But when I try to run idea:idea (or 
idea:module) it fails with following stacktrace:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1444)
        at java.lang.String.substring(String.java:1411)
        at 
org.apache.maven.plugin.idea.AbstractIdeaMojo.toRelative(AbstractIdeaMojo.java:217)
        at 
org.apache.maven.plugin.idea.IdeaModuleMojo.getModuleFileUrl(IdeaModuleMojo.java:777)
        at 
org.apache.maven.plugin.idea.IdeaModuleMojo.getModuleFileUrl(IdeaModuleMojo.java:782)
        at 
org.apache.maven.plugin.idea.IdeaModuleMojo.addSourceFolder(IdeaModuleMojo.java:797)
        at 
org.apache.maven.plugin.idea.IdeaModuleMojo.rewriteModule(IdeaModuleMojo.java:278)
        at 
org.apache.maven.plugin.idea.IdeaMojo.rewriteModule(IdeaMojo.java:205)
        at org.apache.maven.plugin.idea.IdeaMojo.execute(IdeaMojo.java:185)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:488)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
        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:324)
        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)


parent and child project examples are attached.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to