Maven 2.1.0 and spring osgi archetype - mvn package throws StringIndexOutOfBoundsException

Hi,

I setup a module using the maven plugin (but override the maven distro to point to my downloaded version from apache)   and the spring osgi archetype.

all created successfully but when I use the "package" lifecycle target, I get the following stack trace:

hread-0 INFO [org.springframework.osgi.extender.internal.ContextLoaderListener] - Stopping org.springframework.osgi.extender bundle
Thread-3 INFO [org.springframework.context.support.GenericApplicationContext] - Closing org.springframework.context.support.GenericApplicationContext@35fd95: display name [org.springframework.context.support.GenericApplicationContext@35fd95]; startup date [Fri Apr 24 14:56:32 EDT 2009]; root of context hierarchy
Thread-2 INFO [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext] - Application Context service already unpublished
Thread-3 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@c5b819: defining beans [myBean]; root of factory hierarchy
Thread-2 INFO [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext] - Closing org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@ae39fb: display name [OsgiBundleXmlApplicationContext(bundle=TestBundle-testOsgiBundleContext-ems2.impl.BeanOsgiIntegrationTest, config=META-INF/spring/*.xml)]; startup date [Fri Apr 24 14:56:32 EDT 2009]; root of context hierarchy
Thread-2 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@26d235: defining beans []; root of factory hierarchy
[INFO] [bundle:bundle]
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1768)
    at java.lang.String.substring(String.java:1735)
    at org.apache.felix.bundleplugin.BundlePlugin.getMavenResourcePaths(BundlePlugin.java:433)
    at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:165)
    at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:123)
    at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:118)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
    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:585)
    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] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Unknown error occurred



If outside of Intellij  I use the command line "mvn package"  I get the same result.

If outside of Intellij I use the command line to fully create the project using spring osgi archetype,  I can run "mvn package" without problems.
i.e.
mvn archetype:create -DarchetypeGroupId=org.springframework.osgi -DarchetypeArtifactId=spring-osgi-bundle-archetype -DarchetypeVersion=1.1.0 -DgroupId=org.foo -DartifactId=org.foo.my-springdm-bundle -Dversion-0.1


So it seems the Maven plugin in Intellij, messes something up when creating the project.


Any ideas  ?



below is the full startup log:

/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java -Dclassworlds.conf=/opt/apache/apache-maven-2.1.0/bin/m2.conf -Dmaven.home=/opt/apache/apache-maven-2.1.0 -Dfile.encoding=MacRoman -classpath /opt/apache/apache-maven-2.1.0/boot/classworlds-1.1.jar org.codehaus.classworlds.Launcher --no-plugin-registry --fail-fast --no-plugin-updates --strict-checksums -f /opt/projects/ps/ems2/pom.xml package
+ Enabling strict checksum verification on all artifact downloads.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring OSGi Bundle
[INFO]    task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO] Copying 2 resources
Downloading: http://people.apache.org/repo/m2-incubating-repository//org/eclipse/osgi/org.eclipse.osgi/3.2.2/org.eclipse.osgi-3.2.2.pom
[INFO] Unable to find resource 'org.eclipse.osgi:org.eclipse.osgi:pom:3.2.2' in repository apache.m2.incubator (http://people.apache.org/repo/m2-incubating-repository/)
Downloading: http://repo1.maven.org/eclipse//org/eclipse/osgi/org.eclipse.osgi/3.2.2/org.eclipse.osgi-3.2.2.pom
[INFO] Unable to find resource 'org.eclipse.osgi:org.eclipse.osgi:pom:3.2.2' in repository eclipse-repository (http://repo1.maven.org/eclipse/)
Downloading: http://m2.safehaus.org/org/eclipse/osgi/org.eclipse.osgi/3.2.2/org.eclipse.osgi-3.2.2.pom
[INFO] Unable to find resource 'org.eclipse.osgi:org.eclipse.osgi:pom:3.2.2' in repository safehaus-repository (http://m2.safehaus.org)
Downloading: https://springframework.svn.sourceforge.net/svnroot/springframework/repos/repo-ext//org/eclipse/osgi/org.eclipse.osgi/3.2.2/org.eclipse.osgi-3.2.2.pom
[INFO] Unable to find resource 'org.eclipse.osgi:org.eclipse.osgi:pom:3.2.2' in repository spring-ext (https://springframework.svn.sourceforge.net/svnroot/springframework/repos/repo-ext/)
Downloading: http://s3.amazonaws.com/maven.springframework.org/osgi/org/eclipse/osgi/org.eclipse.osgi/3.2.2/org.eclipse.osgi-3.2.2.pom
[INFO] Unable to find resource 'org.eclipse.osgi:org.eclipse.osgi:pom:3.2.2' in repository i21-s3-osgi-repo (http://s3.amazonaws.com/maven.springframework.org/osgi)
Downloading: http://s3.amazonaws.com/maven.springframework.org/milestone/org/eclipse/osgi/org.eclipse.osgi/3.2.2/org.eclipse.osgi-3.2.2.pom
[INFO] Unable to find resource 'org.eclipse.osgi:org.eclipse.osgi:pom:3.2.2' in repository i21-s3-maven-repo (http://s3.amazonaws.com/maven.springframework.org/milestone)
Downloading: http://repo1.maven.org/maven2/org/eclipse/osgi/org.eclipse.osgi/3.2.2/org.eclipse.osgi-3.2.2.pom
[INFO] Unable to find resource 'org.eclipse.osgi:org.eclipse.osgi:pom:3.2.2' in repository central (http://repo1.maven.org/maven2)
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [bundle:manifest {execution: bundle-manifest}]
[INFO] [resources:testResources]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Surefire report directory: /opt/projects/ps/ems2/target/surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running ems2.impl.BeanImplTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.028 sec
Running ems2.impl.BeanOsgiIntegrationTest
main INFO [ems2.impl.BeanOsgiIntegrationTest] - Equinox OSGi Platform [3.2.2.R32x_v20070118] started
main INFO [org.springframework.osgi.test.provisioning.internal.LocalFileSystemMavenRepository] - Local Maven2 repository used: [/opt/apache/.m2/repository]
main INFO [org.springframework.osgi.extender.internal.ContextLoaderListener] - Starting org.springframework.osgi.extender bundle v.[1.0.2]
main INFO [ems2.impl.BeanOsgiIntegrationTest] - ems2/impl/BeanOsgiIntegrationTest-bundle.properties was not found; using defaults
main INFO [ems2.impl.BeanOsgiIntegrationTest] - Automatically creating Manifest for the test bundle
main INFO [ems2.impl.BeanOsgiIntegrationTest] - Loading context for locations: META-INF/spring/*.xml
main INFO [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext] - Refreshing org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@ae39fb: display name [OsgiBundleXmlApplicationContext(bundle=TestBundle-testOsgiBundleContext-ems2.impl.BeanOsgiIntegrationTest, config=META-INF/spring/*.xml)]; startup date [Fri Apr 24 14:56:32 EDT 2009]; root of context hierarchy
main INFO [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext] - Bean factory for application context [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@ae39fb]: org.springframework.beans.factory.support.DefaultListableBeanFactory@26d235
main INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@26d235: defining beans []; root of factory hierarchy
main INFO [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext] - Publishing application context with properties (org.springframework.context.service.name=TestBundle-testOsgiBundleContext-ems2.impl.BeanOsgiIntegrationTest)
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.973 sec
Running ems2.impl.BeanIntegrationTest
main INFO [ems2.impl.BeanIntegrationTest] - Loading context for locations: META-INF/spring/bundle-context.xml
main INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from class path resource [META-INF/spring/bundle-context.xml]
main INFO [org.springframework.context.support.GenericApplicationContext] - Refreshing org.springframework.context.support.GenericApplicationContext@35fd95: display name [org.springframework.context.support.GenericApplicationContext@35fd95]; startup date [Fri Apr 24 14:56:32 EDT 2009]; root of context hierarchy
main INFO [org.springframework.context.support.GenericApplicationContext] - Bean factory for application context [org.springframework.context.support.GenericApplicationContext@35fd95]: org.springframework.beans.factory.support.DefaultListableBeanFactory@c5b819
main INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@c5b819: defining beans [myBean]; root of factory hierarchy
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.242 sec

Results :

Tests run: 3, Failures: 0, Errors: 0, Skipped: 0

Thread-0 INFO [ems2.impl.BeanOsgiIntegrationTest] - Shutting down OSGi platform
Thread-0 INFO [org.springframework.osgi.extender.internal.ContextLoaderListener] - Stopping org.springframework.osgi.extender bundle
Thread-3 INFO [org.springframework.context.support.GenericApplicationContext] - Closing org.springframework.context.support.GenericApplicationContext@35fd95: display name [org.springframework.context.support.GenericApplicationContext@35fd95]; startup date [Fri Apr 24 14:56:32 EDT 2009]; root of context hierarchy
Thread-2 INFO [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext] - Application Context service already unpublished
Thread-3 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@c5b819: defining beans [myBean]; root of factory hierarchy
Thread-2 INFO [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext] - Closing org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@ae39fb: display name [OsgiBundleXmlApplicationContext(bundle=TestBundle-testOsgiBundleContext-ems2.impl.BeanOsgiIntegrationTest, config=META-INF/spring/*.xml)]; startup date [Fri Apr 24 14:56:32 EDT 2009]; root of context hierarchy
Thread-2 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@26d235: defining beans []; root of factory hierarchy
[INFO] [bundle:bundle]
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1768)
    at java.lang.String.substring(String.java:1735)
    at org.apache.felix.bundleplugin.BundlePlugin.getMavenResourcePaths(BundlePlugin.java:433)
    at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:165)
    at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:123)
    at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:118)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
    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:585)
    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] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Unknown error occurred

Embedded error: String index out of range: -1
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Fri Apr 24 14:56:32 EDT 2009
[INFO] Final Memory: 10M/19M
[INFO] ------------------------------------------------------------------------

Process finished with exit code 1

1 comment
Comment actions Permalink

Please check the archetype version suggested by IDEA. For me, it is 1.0.2 - and for thsi version teh problem occurs even if project is created without IDEA using, just from command line.

0

Please sign in to leave a comment.