Skip to content
This repository has been archived by the owner on Jan 21, 2019. It is now read-only.

manifest goal fails with IllegalArgumentException #42

Open
sewe opened this issue Aug 31, 2018 · 16 comments
Open

manifest goal fails with IllegalArgumentException #42

sewe opened this issue Aug 31, 2018 · 16 comments

Comments

@sewe
Copy link

sewe commented Aug 31, 2018

The manifest goal of the latest released version (4.1) fails with an IAE when I have a compile-scoped dependency on

<dependency>
	<groupId>org.junit.jupiter</groupId>
	<artifactId>junit-jupiter-api</artifactId>
	<version>5.2.0</version>
</dependency>

(Why compile rather than test-scoped? Long story, but immaterial to this bug report.)

Here's the exception I get:

Execution default-manifest of goal org.codehaus.mojo:nbm-maven-plugin:4.1:manifest failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-manifest of goal org.codehaus.mojo:nbm-maven-plugin:4.1:manifest failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.<init> (Unknown Source)
    at org.objectweb.asm.ClassReader.<init> (Unknown Source)
    at org.objectweb.asm.ClassReader.<init> (Unknown Source)
    at org.apache.maven.shared.dependency.analyzer.asm.DependencyClassFileVisitor.visitClass (DependencyClassFileVisitor.java:65)
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.visitClass (ClassFileVisitorUtils.java:163)
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.acceptJar (ClassFileVisitorUtils.java:107)
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.accept (ClassFileVisitorUtils.java:61)
    at org.apache.maven.shared.dependency.analyzer.asm.ASMDependencyAnalyzer.analyze (ASMDependencyAnalyzer.java:50)
    at org.codehaus.mojo.nbm.NetBeansManifestUpdateMojo.buildDependencyClasses (NetBeansManifestUpdateMojo.java:920)
    at org.codehaus.mojo.nbm.NetBeansManifestUpdateMojo.buildProjectDependencyClasses (NetBeansManifestUpdateMojo.java:763)
    at org.codehaus.mojo.nbm.NetBeansManifestUpdateMojo.checkModuleClassPath (NetBeansManifestUpdateMojo.java:667)
    at org.codehaus.mojo.nbm.NetBeansManifestUpdateMojo.execute (NetBeansManifestUpdateMojo.java:530)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
@mkleint
Copy link
Contributor

mkleint commented Aug 31, 2018

maven source/target level is your project? and what about the dependency?

@sewe
Copy link
Author

sewe commented Aug 31, 2018

Source/target level is 1.8. The dependency, as far as I can tell with the help of javap, uses version 52.0 (i.e., Java 8) exclusively.

That being said, I was able to work around the issue by upgrading the plugin's maven-dependency-analyzer dependency, as was done in e962e93:

<dependency>
    <groupId>org.apache.maven.shared</groupId>
    <artifactId>maven-dependency-analyzer</artifactId>
    <version>1.10</version>
</dependency>

So maybe a release with the dependency upgrade is in order?

@ebarboni
Copy link
Contributor

Hi maybe we must do a release ?

@mkleint
Copy link
Contributor

mkleint commented Aug 31, 2018

yes, we should. I fear I've lost the keys to publish to the repo and will need to do the regeneration dance. :(

@jboesl
Copy link

jboesl commented Aug 31, 2018

I had a problem with 1.10 verison of maven-dependency-analyzer. It detects class names which appear as string in the source code and reports those as dependencies.
For me the fix was to not upgrade the maven-dependency-analyzer but to upgrade org.ow2.asm.

@mkleint
Copy link
Contributor

mkleint commented Sep 3, 2018

I've tried to find and reset my password on oss.sonatype.org to be able to upload. To no avail. I also don't appear to have the gpg keys in place according to this doc - http://www.mojohaus.org/development/performing-a-release.html

To be honest, I'm not actively using the plugin anymore for over 4 years now. Happy to reply to issues filed or apply patches but I just can't find the motivation to go through the administration hassle. Feel free to ping people at https://groups.google.com/forum/#!forum/mojohaus-dev and let them know you are taking over the project @ebarboni they should be able to assist you.

@mkleint
Copy link
Contributor

mkleint commented Sep 3, 2018

alternatively someone from the new apache netbeans project could take over.

@ebarboni
Copy link
Contributor

ebarboni commented Sep 3, 2018

do you think it is possible to make nbm maven plugin to be part of the Apache Netbeans ?

@mkleint
Copy link
Contributor

mkleint commented Sep 3, 2018

that would be awesome. Apache does have access to maven central. Obviously I'm not sure about the procedure of moving, it's likely to be more administrative and legal work.

@sewe
Copy link
Author

sewe commented Sep 4, 2018

@ebarboni @mkleint Moving the nbm-maven-plugin under the umbrella of Apache NetBeans would be great! Maybe this is an idea one of you can present at the NetBeans virtual meetup (next one is this Thursday: https://mail-archives.apache.org/mod_mbox/netbeans-dev/201809.mbox/browser). The main topic of these meetups is the Oracle -> Apache transition of NetBeans, so you can expect lots of people knowledgeable about the necessary paperwork for moving code to Apache.

@ebarboni
Copy link
Contributor

ebarboni commented Sep 4, 2018

@mkleint do you think we can extend to all nb-shared, nb repository and alse archetype ?
Maybe we should have a agreement of Jesse Glick who was involved in thoose plugin.

@sewe good catch

@SamSharaf
Copy link

SamSharaf commented Dec 26, 2018

The fix is to update the following artifact in the file nbm-maven-plugin/pom.xml:

    <dependency>
        <groupId>org.apache.maven.shared</groupId>
        <artifactId>maven-dependency-analyzer</artifactId>
        <version>1.10</version> to <version>1.11.1</version>
    </dependency>

The fix is committed here and waiting for maven-dependency-analyzer version 1.11.1 to be released

@mkleint I see the maven-dependency-analyzer team promoted for the 1.11.2-SNAPSHOT dev iteration

I hope their 1.11.1 release to central will be soon because updating the nbm-maven-plugin to point to the maven-dependency-analyzer version 1.11.1 is required by many Netbeans IDE plugins especially jeddict

Copied @jGauravGupta

@SamSharaf
Copy link

@sewe @mkleint @ebarboni @jglick @hboutemy @jGauravGupta
Please see the explanation below to understand the urgency of this issue.

The API org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils sits in the maven-dependency-analyzer plugin source code. This API visits the dependency file hierarchy and processes any file ending with .class as a java class. This assumption is broken starting JDK 9 onwards by the introduction of package-info.class and module-info.class .

The case which I encountered was a Netbeans plugin which has the following transitive dependency

<dependency>
    <groupId>javax.json.bind</groupId>
    <artifactId>javax.json.bind-api</artifactId>
    <version>1.0</version>
</dependency>

The snapshot below shows the sources hierarchy which includes both of (package-info.class) and (module-info.class)

image

The debugging snapshot below shows (module-info.class) is being processed as a normal Java class:

image

@jglick
Copy link
Contributor

jglick commented Dec 31, 2018

Maybe we should have a agreement of Jesse Glick who was involved in thoose plugin.

I am not actively maintaining this.

@ebarboni
Copy link
Contributor

ebarboni commented Jan 7, 2019

the new home of the plugin is here: fill free to submit a PR not the change on the groupid
https://github.com/apache/incubator-netbeans-mavenutils/

@jglick
Copy link
Contributor

jglick commented Jan 7, 2019

the new home of the plugin is here

Then to avoid confusion please delete sources from the master branch of this plugin, close or refile open issues, and archive this repository.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants