简体   繁体   English

Tycho 编译器没有从插件依赖中找到类

[英]Tycho compiler does not find classes from plugin dependecies

I am trying to build a plugin with Tycho.我正在尝试用 Tycho 构建一个插件。 There are no errors in the Eclipse workspace, but when I try to compile it with Maven I got the following errors (more than 57 errors): Eclipse 工作区中没有错误,但是当我尝试使用 Maven 编译它时,出现以下错误(超过 57 个错误):

    [INFO] Resolving dependencies of MavenProject: uk.xman.tool:xman.xtend.conditiondsl:2.0.0 @ C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\pom.xml
    [INFO] Resolving class path of MavenProject: uk.xman.tool:xman.xtend.conditiondsl:2.0.0 @ C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\pom.xml
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Build Order:
    [INFO] 
    [INFO] xman.maven.parent
    [INFO] xman.eclipse.target_definition
    [INFO] xman.xtend.conditiondsl
    [INFO] 
    [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building xman.maven.parent 2.0.0
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ xman.maven.parent ---
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building xman.eclipse.target_definition 2.0.0
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ xman.eclipse.target_definition ---
    [INFO] Deleting C:\Users\Simone\OneDrive\Eclipse\xman.eclipse.target_definition\target
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building xman.xtend.conditiondsl 2.0.0
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ xman.xtend.conditiondsl ---
    [INFO] Deleting C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\target
    [INFO] 
    [INFO] --- tycho-packaging-plugin:0.22.0:build-qualifier (default-build-qualifier) @ xman.xtend.conditiondsl ---
    [INFO] The project's OSGi version is 2.0.0
    [INFO] 
    [INFO] --- tycho-packaging-plugin:0.22.0:validate-id (default-validate-id) @ xman.xtend.conditiondsl ---
    [INFO] 
    [INFO] --- tycho-packaging-plugin:0.22.0:validate-version (default-validate-version) @ xman.xtend.conditiondsl ---
    [INFO] 
    [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ xman.xtend.conditiondsl ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\src\main\resources
    [INFO] 
    [INFO] --- tycho-compiler-plugin:0.22.0:compile (default-compile) @ xman.xtend.conditiondsl ---
    [INFO] Compiling 36 source files to C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\target\classes
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] 
    [INFO] xman.maven.parent ................................. SUCCESS [  0.087 s]
    [INFO] xman.eclipse.target_definition .................... SUCCESS [  0.005 s]
    [INFO] xman.xtend.conditiondsl ........................... FAILURE [  2.628 s]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 32.542 s
    [INFO] Finished at: 2015-06-08T19:36:02+00:00
    [INFO] Final Memory: 64M/154M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.22.0:compile (default-compile) on project xman.xtend.conditiondsl: Compilation failure: Compilation failure:
    [ERROR] C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\src-gen\uk\ac\man\xman\dsl\services\ConditionDSLGrammarAccess.java:[937]
    [ERROR] public XbaseGrammarAccess.XExpressionInsideBlockElements getXExpressionInsideBlockAccess() {
    [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ERROR] XbaseGrammarAccess.XExpressionInsideBlockElements cannot be resolved to a type
    [ERROR] C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\src-gen\uk\ac\man\xman\dsl\services\ConditionDSLGrammarAccess.java:[938]
    [ERROR] return gaXbase.getXExpressionInsideBlockAccess();
    [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ERROR] The method getXExpressionInsideBlockAccess() is undefined for the type XbaseGrammarAccess
    [ERROR] C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\src-gen\uk\ac\man\xman\dsl\services\ConditionDSLGrammarAccess.java:[942]
    [ERROR] return getXExpressionInsideBlockAccess().getRule();
    [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ERROR] The method getXExpressionInsideBlockAccess() is undefined for the type ConditionDSLGrammarAccess
    [ERROR] C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\src-gen\uk\ac\man\xman\dsl\parser\antlr\internal\InternalConditionDSLParser.java:[3918]
    [ERROR] newLeafNode(kw, grammarAccess.getOpCompareAccess().getLessThanSignEqualsSignKeyword_1());
    [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ERROR] The method getLessThanSignEqualsSignKeyword_1() is undefined for the type XbaseGrammarAccess.OpCompareElements
    [ERROR] C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\src-gen\uk\ac\man\xman\dsl\parser\antlr\internal\InternalConditionDSLParser.java:[4541]
    [ERROR] newLeafNode(kw, grammarAccess.getOpOtherAccess().getLessThanSignEqualsSignGreaterThanSignKeyword_9());
    [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ERROR] The method getLessThanSignEqualsSignGreaterThanSignKeyword_9() is undefined for the type XbaseGrammarAccess.OpOtherElements
    [ERROR] C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\src-gen\uk\ac\man\xman\dsl\parser\antlr\internal\InternalConditionDSLParser.java:[5748]
    [ERROR] newCompositeNode(grammarAccess.getXCastedExpressionAccess().getXMemberFeatureCallParserRuleCall_0());
    [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ERROR] The method getXMemberFeatureCallParserRuleCall_0() is undefined for the type XbaseGrammarAccess.XCastedExpressionElements
    [ERROR] C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\src-gen\uk\ac\man\xman\dsl\parser\antlr\internal\InternalConditionDSLParser.java:[6946]
    [ERROR] newCompositeNode(grammarAccess.getXPrimaryExpressionAccess().getXFeatureCallParserRuleCall_3());
    [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ERROR] The method getXFeatureCallParserRuleCall_3() is undefined for the type XbaseGrammarAccess.XPrimaryExpressionElements
    [ERROR] C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\src-gen\uk\ac\man\xman\dsl\parser\antlr\internal\InternalConditionDSLParser.java:[6968]
    [ERROR] newCompositeNode(grammarAccess.getXPrimaryExpressionAccess().getXLiteralParserRuleCall_4());
    [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ERROR] The method getXLiteralParserRuleCall_4() is undefined for the type XbaseGrammarAccess.XPrimaryExpressionElements
    [ERROR] C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\src-gen\uk\ac\man\xman\dsl\parser\antlr\internal\InternalConditionDSLParser.java:[6990]
    [ERROR] newCompositeNode(grammarAccess.getXPrimaryExpressionAccess().getXIfExpressionParserRuleCall_5());
    [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ERROR] The method getXIfExpressionParserRuleCall_5() is undefined for the type XbaseGrammarAccess.XPrimaryExpressionElements
    [ERROR] C:\Users\Simone\OneDrive\Eclipse\xman.xtend.conditiondsl\src-gen\uk\ac\man\xman\dsl\parser\antlr\internal\InternalConditionDSLParser.java:[7012]
    [ERROR] newCompositeNode(grammarAccess.getXPrimaryExpressionAccess().getXForLoopExpressionParserRuleCall_6());
    [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is the MANIFEST:这是清单:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: xman.xtext.conditiondsl
Bundle-Vendor: University of Manchester
Bundle-Version: 2.0.0
Bundle-SymbolicName: xman.xtend.conditiondsl;singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xtext.xbase;bundle-version="2.4.3",
 org.eclipse.xtext.generator;bundle-version="2.4.3",
 org.eclipse.emf.mwe2.launch;resolution:=optional,
 org.eclipse.xtext;bundle-version="2.4.3",
 org.eclipse.xtext.util;bundle-version="2.4.3",
 org.eclipse.emf.ecore, 
 org.eclipse.emf.common,
 org.antlr.runtime,
 org.eclipse.xtext.common.types;bundle-version="2.4.3",
 org.eclipse.xtext.xbase.lib;bundle-version="2.4.3"
Import-Package: org.apache.commons.logging;version="1.1.1",
 org.apache.log4j;version="1.2.15",
 org.eclipse.xtext.xbase.lib
Export-Package: uk.ac.man.xman.dsl,
 uk.ac.man.xman.dsl.conditionDSL,
 uk.ac.man.xman.dsl.conditionDSL.impl,
 uk.ac.man.xman.dsl.conditionDSL.util,
 uk.ac.man.xman.dsl.formatting;uses:="org.eclipse.xtext.formatting.impl",
 uk.ac.man.xman.dsl.generator;uses:="org.eclipse.emf.ecore.resource,org.eclipse.xtext.generator",
 uk.ac.man.xman.dsl.jvmmodel;uses:="org.eclipse.emf.ecore,org.eclipse.xtext.xbase.jvmmodel",
 uk.ac.man.xman.dsl.parser.antlr,
 uk.ac.man.xman.dsl.parser.antlr.internal,
 uk.ac.man.xman.dsl.scoping;uses:="org.eclipse.xtext.scoping.impl",
 uk.ac.man.xman.dsl.serializer,
 uk.ac.man.xman.dsl.services,
 uk.ac.man.xman.dsl.validation
Bundle-ClassPath: .
Bundle-RequiredExecutionEnvironment: J2SE-1.5

It seems like that Tycho compiler does not consider the plugin dependencies when it tries to compile: The type that is missing is defined inside the jar org.eclipse.xtext.xbase that is required in the MANIFEST. Tycho 编译器在尝试编译时似乎没有考虑插件依赖项:缺少的类型在 MANIFEST 中所需的 jar org.eclipse.xtext.xbase 中定义。

Any ideas how to fix this problem?任何想法如何解决这个问题?

When you enable debug output ( -X ), the log output of the tycho-compiler-plugin includes the exact list of JARs that Tycho compiles against.当您启用调试输出 ( -X ) 时,tycho-compiler-plugin 的日志输出包括 Tycho 编译所针对的 JAR 的确切列表。 (Look for [DEBUG] Classpath: ) (寻找[DEBUG] Classpath:

So if you eg see that Tycho's dependency resolution picked the wrong version of org.eclipse.xtext.xbase, you can either因此,如果您例如看到 Tycho 的依赖项解析选择了错误版本的 org.eclipse.xtext.xbase,您可以

  • change the target platform so that only the version you want is included, or更改目标平台,以便只包含您想要的版本,或
  • make the dependency declared in the MANIFEST.MF more restrictive.使 MANIFEST.MF 中声明的依赖项更具限制性。

In your example you specify with Require-Bundle: org.eclipse.xtext.xbase;bundle-version="2.4.3" that you want version 2.4.3 or later.在您的示例中,您使用Require-Bundle: org.eclipse.xtext.xbase;bundle-version="2.4.3"您想要版本 2.4.3 或更高版本。 But maybe this is wrong and you actually require a higher minimum version.但也许这是错误的,您实际上需要更高的最低版本。

问题出在 org.eclipse.xtext.xbase 的版本上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM