Tycho compiler does not find classes from plugin dependecies

2.2k views Asked by At

I am trying to build a plugin with 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):

    [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.

Any ideas how to fix this problem?

2

There are 2 answers

0
oberlies On BEST ANSWER

When you enable debug output (-X), the log output of the tycho-compiler-plugin includes the exact list of JARs that Tycho compiles against. (Look for [DEBUG] Classpath:)

So if you e.g. see that Tycho's dependency resolution picked the wrong version of org.eclipse.xtext.xbase, you can either

  • change the target platform so that only the version you want is included, or
  • make the dependency declared in the MANIFEST.MF more restrictive.

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. But maybe this is wrong and you actually require a higher minimum version.

0
user3727540 On

The problems was with the version of org.eclipse.xtext.xbase.