akasey1 / addjars-maven-plugin

Automatically exported from code.google.com/p/addjars-maven-plugin
Apache License 2.0
0 stars 0 forks source link

file not found error for 'pom.xml' #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. This may be hard to 'reproduce', but I'll try my best to describe the 
problem.

I am getting a file not found error at the end of my mvn install, it is looking 
for 'pom.xml' in your target/com.googlecode.addjars.mojo.AddJarsMojo/ 
directory.  That file is not there.  I do have a 'pom-modified.xml' there.  If 
I rename it to pom.xml and re-run the mvn install command the build completes 
successfully.  All jars are included also!!  I can't tell you how much work 
this will save me, but it is a lot! The product I am using as a (Adobe CQ) has 
100+ jars that it needs and of course we are switching versions soon... so I 
wanted an automated way to include a folder of jars on the classpath during 
build time in maven and you gave it too me!  Now I feel I am very close, if I 
can just get it to not have the file not found exception.  I will attach my 
parent pom.xml, my child pom.xml and the pom-modified.xml to this issue.  

Thank you so much for your work on this!

-Adam Yocum

Maven 3.0.4
Windows 7 + CYGWIN installed
addjars version: 1.0.3

here is the error output...

[ERROR] An internal error occurred
java.io.FileNotFoundException: 
c:\AYall\SWD\projects\CQ\psul-maven\psul\psul-services\target\com.googlecode.add
jars.mojo.AddJarsMojo\pom.xml (The system cannot find the file specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at aQute.lib.osgi.FileResource.openInputStream(FileResource.java:15)
        at aQute.lib.osgi.FileResource.copy(FileResource.java:36)
        at aQute.lib.osgi.FileResource.write(FileResource.java:31)
        at aQute.lib.osgi.Jar.writeResource(Jar.java:445)
        at aQute.lib.osgi.Jar.write(Jar.java:224)
        at aQute.lib.osgi.Jar.write(Jar.java:192)
        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:362)
        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:264)
        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:255)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        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:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        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)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.060s
[INFO] Finished at: Fri Jun 15 13:58:15 EDT 2012
[INFO] Final Memory: 22M/508M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.felix:maven-bundle-plugin:2.3.7:bundle (default-bundle) on project 
psul-services: Internal error in maven-bundle-plugin: 
c:\AYall\SWD\projects\CQ\psul-maven\psul\psul-se
rvices\target\com.googlecode.addjars.mojo.AddJarsMojo\pom.xml (The system 
cannot find the file specified) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
org.apache.felix:maven-bundle-plugin:2.3.7:bundle (default-bundle) on project 
psul-services: Internal error in maven-bundle-plugin
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        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:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        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.MojoExecutionException: Internal error in 
maven-bundle-plugin
        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:412)
        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:264)
        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:255)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: java.io.FileNotFoundException: 
c:\AYall\SWD\projects\CQ\psul-maven\psul\psul-services\target\com.googlecode.add
jars.mojo.AddJarsMojo\pom.xml (The system cannot find the file specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at aQute.lib.osgi.FileResource.openInputStream(FileResource.java:15)
        at aQute.lib.osgi.FileResource.copy(FileResource.java:36)
        at aQute.lib.osgi.FileResource.write(FileResource.java:31)
        at aQute.lib.osgi.Jar.writeResource(Jar.java:445)
        at aQute.lib.osgi.Jar.write(Jar.java:224)
        at aQute.lib.osgi.Jar.write(Jar.java:192)
        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:362)
        ... 23 more
[ERROR]
[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/MojoExecutionException
c:\AYall\SWD\projects\CQ\psul-maven\psul\psul-services>

Original issue reported on code.google.com by adamyo...@gmail.com on 15 Jun 2012 at 6:30

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Adam,

I have found out that the issue has something to do with the 
maven-bundle-plugin declaration.
When I replace <packaging>bundle</packaging> with <packaging>jar</packaging> in 
psul-services/pom.xml , the addjars plugin works.

I will investigate the issue further and try to resolve it.

Meanwhile I suggest introducing one more module (say, psul-libs) to workaround 
the issue.
The module should be of type 'pom' and contain the addjars-maven-plugin 
declaration.
The psul-services module should depend on psul-libs.
Please let me know whether this solution works for you.

Thank you.

Original comment by v.kary...@gmail.com on 17 Jun 2012 at 9:57

GoogleCodeExporter commented 9 years ago

Original comment by v.kary...@gmail.com on 17 Jun 2012 at 10:03

GoogleCodeExporter commented 9 years ago
I took the time this evening to clone your code to my local machine...  

I changed the line (in file AddJarsMojo.java)....

File pomFile = new File(workdir, "pom-modified.xml");

to 

File pomFile = new File(workdir, "pom.xml");

Built and deployed to local repository... it works now for me for both jar and 
bundle package type.  I need to use bundle though, I tested with just jar and 
it does not meet my OSGI requirements.  If there was not a reason behind having 
it named pom-modified.xml and not pom.xml maybe you can add this change to your 
tool.  This plug in could be very useful for many other OSGI developers out 
there, so if the change doesn't break anything else... 

p.s.  thanks again, and it was cool to see how these maven plugins are built :) 
It was as easy as 123 to check out and build with netbeans, good times... 

-Adam

Original comment by adamyo...@gmail.com on 19 Jun 2012 at 2:31

GoogleCodeExporter commented 9 years ago
Thank you for providing the patch, Adam.
I have released it in a new version of plugin (1.0.4). The new version should 
become available in maven central repository within the next few hours.

Agree, such a plugin should have been implemented years ago.
It's strange that the orthodox maven developers have been ignoring such an 
obvious need.

Original comment by v.kary...@gmail.com on 19 Jun 2012 at 8:07