This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 232648 - NBM Maven plugin doesn't pull in transitive dependencies
Summary: NBM Maven plugin doesn't pull in transitive dependencies
Status: RESOLVED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.3.1
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-13 08:28 UTC by dbell
Modified: 2013-07-15 14:07 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dbell 2013-07-13 08:28:04 UTC
Using the NBM Maven plugin, and following (roughly) the New Language Support (lexer) tutorial results in a compilation error.

> [INFO] -------------------------------------------------------------
> [ERROR] COMPILATION ERROR : 
> [INFO] -------------------------------------------------------------
> [ERROR] Failure executing javac, but could not parse the error:
> 
> 
> An annotation processor threw an uncaught exception.
> Consult the following stack trace for details.
> java.lang.NoClassDefFoundError: org/netbeans/lib/editor/codetemplates/CodeTemplateCompletionProvider
>     at org.netbeans.modules.csl.core.LanguageRegistrationProcessor.registerCodeCompletion(LanguageRegistrationProcessor.java:270)
>     at org.netbeans.modules.csl.core.LanguageRegistrationProcessor.handleProcess(LanguageRegistrationProcessor.java:160)
>     at org.openide.filesystems.annotations.LayerGeneratingProcessor.process(LayerGeneratingProcessor.java:121)
>     at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
>     at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
>     at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
>     at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
>     at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
>     at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
>     at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
>     at com.sun.tools.javac.main.Main.compile(Main.java:439)
>     at com.sun.tools.javac.main.Main.compile(Main.java:353)
>     at com.sun.tools.javac.main.Main.compile(Main.java:342)
>     at com.sun.tools.javac.main.Main.compile(Main.java:333)
>     at com.sun.tools.javac.Main.compile(Main.java:94)
>     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:606)
>     at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess0(JavacCompiler.java:551)
>     at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:526)
>     at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:167)
>     at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:678)
>     at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
>     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:606)
>     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: java.lang.ClassNotFoundException: org.netbeans.lib.editor.codetemplates.CodeTemplateCompletionProvider
>     at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
>     at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>     ... 45 more

These are the dependencies used:

    <properties>
        <netbeans.version>RELEASE731</netbeans.version>
    </properties>

    <dependencies>        
        <!-- Common Scripting Language API (new) -->
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-netbeans-modules-csl-api</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
        <!-- Datasystems API -->
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-openide-loaders</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
        <!-- Dialogs API -->
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-openide-dialogs</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
        <!-- File System API -->
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-openide-filesystems</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
        <!-- Lexer API -->
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-netbeans-modules-lexer</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
        <!-- Lookup API -->
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-openide-util-lookup</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
        <!-- Nodes API -->
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-openide-nodes</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
        <!-- Text API -->
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-openide-text</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
        <!-- UI Utilities API -->
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-openide-awt</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
        <!-- Utilities API -->
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-openide-util</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
        <!-- Window System API -->
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-openide-windows</artifactId>
            <version>${netbeans.version}</version>
        </dependency>


Using the same code and module dependencies with a standard (Ant-based) NetBeans module project, it compiles properly.

Workaround:

Adding the following two dependencies fixes the problem.

        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-netbeans-modules-editor-codetemplates</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
        <dependency>
            <groupId>org.netbeans.modules</groupId>
            <artifactId>org-netbeans-modules-editor-errorstripe</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
Comment 1 Milos Kleint 2013-07-15 07:50:29 UTC
the problem appears to be that when generating the maven poms for netbeans.org artifacts we've always skipped implementation dependencies. The point was to reduce the number of dependencies downloaded and typically it didn't matter until annotation processors came around.

we will need to create a new version of nb-repository plugin and index new versions of netbeans with that. No cure for old versions of netbeans already at the netbeans remote repository. (apart from users generate their own bits with the new version of the plugin and avoid using the official repository)
Comment 2 Milos Kleint 2013-07-15 14:07:42 UTC
version 1.1 of nb-repository-plugin was released today. the binary bits will appear in central shortly.

pgebauer: please use the new 1.1 version when generating new content for dev-SNAPSHOT and of upcoming releases. Thanks. It will appear here: http://repo1.maven.org/maven2/org/codehaus/mojo/nb-repository-plugin/