RBuractaon / addjars-maven-plugin

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

addjars breaks the build #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Add 'lib' folder to project root.
2. Add custom *.jar file to the lib folder.
3. configure pom.xml with addjars:

....
<plugin>
  <groupId>com.googlecode.addjars-maven-plugin</groupId>
  <artifactId>addjars-maven-plugin</artifactId>
  <version>1.0.4</version>
    <executions>
      <execution>
        <goals>
      <goal>add-jars</goal>
    </goals>
        <configuration>
              <resources>
            <resource>
              <directory>${basedir}/lib</directory>
              <includes>
                <include>**/*.jar</include>
              </includes>
            </resource>
            </resources>
          </configuration>
        </execution>
  </executions>
</plugin>
....

What is the expected output? What do you see instead?
Expected: eclipse:eclipse should add custom.jar to build dependencies. But 
output is:

[ERROR] Failed to execute goal 
com.googlecode.addjars-maven-plugin:addjars-maven-plugin:1.0.4:add-jars 
(default) on project audatex-vw-claimcalculation: null: MojoExecutionException: 
UnsupportedOperationException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
com.googlecode.addjars-maven-plugin:addjars-maven-plugin:1.0.4:add-jars 
(default) on project audatex-vw-claimcalculation: null
    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.MojoExecutor.executeForkedExecutions(MojoExecutor.java:365)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199)
    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
    at com.googlecode.addjars.mojo.AddJarsMojo.execute(AddJarsMojo.java:83)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 23 more
Caused by: java.lang.UnsupportedOperationException
    at java.util.Collections$UnmodifiableCollection.add(Collections.java:1075)
    at com.googlecode.addjars.mojo.AddJarsMojo.executeInt(AddJarsMojo.java:103)
    at com.googlecode.addjars.mojo.AddJarsMojo.execute(AddJarsMojo.java:77)
    ... 25 more

What version of the product are you using? On what operating system?

addjars version 1.0.4, maven 3.0.4, on linux mint 13

Please provide any additional information below.

Original issue reported on code.google.com by henning....@codecentric.de on 16 Jul 2012 at 8:44

GoogleCodeExporter commented 8 years ago
Thank you for reporting the issue.
Unfortunately I haven't managed to reproduce it: my build works with the same 
declaration as yours.

Could you possibly send me the complete content of your pom.xml? 

Original comment by v.kary...@gmail.com on 17 Jul 2012 at 3:14

GoogleCodeExporter commented 8 years ago
Hi, attached is the pom extracted from hg. I had to reconstruct it, so 
formating is lost. sorry.

thanks.

Original comment by henning....@codecentric.de on 17 Jul 2012 at 3:24

GoogleCodeExporter commented 8 years ago
Sorry, cannot find the attached file anywhere.
Could you resend it please?

Original comment by v.kary...@gmail.com on 17 Jul 2012 at 6:10

GoogleCodeExporter commented 8 years ago
Here is the pom.xml as text:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>

     <groupId>my-groupId</groupId>
     <artifactId>my-artifactId</artifactId>
     <version>0.0.1</version>
     <packaging>war</packaging>

     <build>
         <plugins>
             <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
                 <version>2.0.2</version>
                 <configuration>
                     <source>1.6</source>
                     <target>1.6</target>
                 </configuration>
             </plugin>
             <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
                 <version>2.9</version>
                 <configuration>
                     <wtpversion>2.0</wtpversion>
                 </configuration>
             </plugin>

<plugin>
<groupId>com.googlecode.addjars-maven-plugin</groupId>
   <artifactId>addjars-maven-plugin</artifactId>
   <version>1.0.4</version>
     <executions>
       <execution>
         <goals>
       <goal>add-jars</goal>
     </goals>
         <configuration>
               <resources>
             <resource>
               <directory>${basedir}/lib</directory>
               <includes>
                 <include>**/*.jar</include>
               </includes>
             </resource>
             </resources>
           </configuration>
         </execution>
   </executions>
</plugin>

         </plugins>
     </build>

     <dependencies>

         <dependency>
             <groupId>javax.xml.ws</groupId>
             <artifactId>jaxws-api</artifactId>
             <version>2.2.8</version>
         </dependency>

     </dependencies>

</project>

Original comment by henning....@codecentric.de on 19 Jul 2012 at 9:09

GoogleCodeExporter commented 8 years ago
I have tried your pom.xml but the problem did not occur in my case.
Please have a look at the sample project in the attached archive. It builds 
successfully for me.
Could you check it and modify so that the problem takes place?

BTW
I did see another problem though: the war plugin could not find the web.xml 
file when its path was set relatively. To fix it I had to set the absolute path 
to web.xml. I will look into this problem separately.

Original comment by v.kary...@gmail.com on 20 Jul 2012 at 7:40

Attachments:

GoogleCodeExporter commented 8 years ago
I have a similar issue too, however it builds on a couple boxes, but only seems 
to fail on one box.  On that box we are unable to not reproduce this error. 

Original comment by warchild...@gmail.com on 21 Aug 2012 at 9:39

GoogleCodeExporter commented 8 years ago
I have found a way to reproduce this for sure.  Run a mvn install 
cobertura:cobertura deploy.

Original comment by warchild...@gmail.com on 21 Aug 2012 at 9:45

GoogleCodeExporter commented 8 years ago
Unfortunately, I am still unable to reproduce the originally reported issue. 
Please attach a sample project where I can see it.

As for the issue I mentioned in comment #5, it can be solved by specifying 
absolute path to web.xml:
<webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
instead of 
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>

Original comment by v.kary...@gmail.com on 22 Aug 2012 at 5:40

GoogleCodeExporter commented 8 years ago
Is that because maven version?

Original comment by K...@navidao.com on 6 Sep 2012 at 3:57

GoogleCodeExporter commented 8 years ago
> Is that because maven version?

The plugin requires maven version 3.0.3 or higher.

I have to repeat: I am unable to reproduce this issue.
If you want the issue get fixed, please create a sample project and attach it. 
Then I'll be able to continue with the investigation.

Original comment by v.kary...@gmail.com on 6 Sep 2012 at 4:11

GoogleCodeExporter commented 8 years ago
I have the same issue too. I have made a little investigation. I added simple 
configuration from Usage page. Eclipse says me: "Plugin execution is not 
covered by lifecycle configuration". I am using maven-source-plugin, 
maven-clean-plugin, maven-jar-plugin. I tried to add "phase". For example:
...
    <executions>
        <execution>
               <phase>install</phase>
        <goals>
...
There are no errors if you use "install" phase. And error is appeared if you 
use "compile" phase. The same happens if you use maven install on both cases. 
Unfortunately, I can't still compile my project. But I hope this helps with 
investigation to you. As I understand addjars-maven-plugin conflicts with 
maven-source-plugin, maven-clean-plugin, maven-jar-plugin.

Let me know if you have questions for me. Thanks.

Original comment by a.podava...@gmail.com on 2 Dec 2012 at 7:35

GoogleCodeExporter commented 8 years ago
Also, as topic starter said we have 
..
Caused by: java.lang.UnsupportedOperationException
    at java.util.Collections$UnmodifiableCollection.add(Collections.java:1075)
    at com.googlecode.addjars.mojo.AddJarsMojo.executeInt(AddJarsMojo.java:103)
    at com.googlecode.addjars.mojo.AddJarsMojo.execute(AddJarsMojo.java:77)
    ... 25 more

Take a look at patch. May be it solves the problem.
Patch description: Do not add to unmodifiable collection. Create new one 
instead.

Original comment by a.podava...@gmail.com on 2 Dec 2012 at 9:28

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
a.podavalov: thank you for providing the patch. 
Since it does not break anything (at least), I've applied the patch and 
released a new version of the plugin (1.0.5). It will appear in Maven Central 
in a couple of hours.

I don't think however the patch will fix all of the issues mentioned above. The 
plugin is a hack in nature, and the hack often conflicts with hacks used in 
other plugins :)

The safest way to use the plugin is to move its declaration to a separate pom 
(of packaging 'pom'). Just like it is suggested in the section "IDE, 
addjars-maven-plugin, and autocompletion" of 
http://code.google.com/p/addjars-maven-plugin/wiki/UsagePage .

Original comment by v.kary...@gmail.com on 9 Dec 2012 at 9:42

GoogleCodeExporter commented 8 years ago
Also I have to admit that I am not going to spent much efforts to support  this 
plugin. I've moved my project to Gradle, where you can easily add local jars to 
your project classpath.

Patches from the community are welcome however: I will review and release them.

Original comment by v.kary...@gmail.com on 9 Dec 2012 at 9:49

GoogleCodeExporter commented 8 years ago
Have you used any specific M2E connector with you POM configuration for it to 
work? I have the same problem as those mentioned before, and your sample 
project does the same thing too.

"Plugin execution not covered by lifecycle configuration"

Original comment by Sharkep...@gmail.com on 7 Jan 2013 at 10:43