2013-07-11 76 views
0

我正在使用the Maven plugin爲新語言構建NetBeans插件。我遵循(大致)this tutorial,但我最終無法編譯(下面的堆棧跟蹤)。NetBeans Maven新語言支持

使用與標準(基於Ant的)NetBeans模塊項目相同的代碼和模塊依賴關係,它可以正確編譯。它找不到的類似乎在另一個模塊(org-netbeans-modules-editor-codetemplates)中可用,但是當我使用基於Ant的項目時,我不需要該模塊。另外,如果我添加了該模塊,那麼在另一個模塊中我找不到另一個類的錯誤,這使得我做錯了事。我錯過了什麼嗎?

堆棧跟蹤:

[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 

我的依賴

<!-- 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> 

回答

3

你可能已經在爲平臺的文物Maven的pom.xml文件的生成發現錯誤。雖然org-netbeans-modules-csl-api jar包含對代碼模板模塊(org.netbeans.modules.editor.codetemplates/1 = 1)的模塊依賴關係,但它不存在於解析的依賴關係列表中。請針對https://netbeans.org/bugzilla組件提交問題:apisupport子組件:maven。

謝謝。

PS:解決方法確實是您嘗試過但未完成的路徑。繼續添加缺失的依賴關係,直到滿足註釋處理器的運行時依賴關係。

要求(針對NetBeans 7.3.1)的依賴關係是:

<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> 
+0

感謝。添加上面的依賴關係修復了它。問題是:https://netbeans.org/bugzilla/show_bug.cgi?id=232648 – Daniel