Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Buckminster » Buckminster can't resolve imports from Google Guava (Xtend)(Build fails when Xtend project is build with Buckminster and Jenkins, because there is seems to be no reference to Guava)
Buckminster can't resolve imports from Google Guava (Xtend) [message #1716795] Tue, 08 December 2015 09:33 Go to next message
Sven Eckhardt is currently offline Sven EckhardtFriend
Messages: 2
Registered: December 2015
Junior Member
Hello,

I'm trying to build Xtend Projects with Buckminster and Jenkins. I try to run the Xtend compiler in Buckminster like shown in ablogpost from Lorenzo Bettini (http://www.lorenzobettini.it /2013/09/using-the-xtend-compiler-in-buckminster-builds/). However, there are Error Messages, when trying to run the Xtend Compiler in the Buckminster Build (everything works fine, when running it locally in eclipse):

0    [main] ERROR e.compiler.batch.XtendBatchCompiler  - 
ERROR: 	MyExample.xtend - 
3: com.google.common.base.Strings cannot be resolved to a type.
0 [main] ERROR org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler  - 
ERROR: 	MyExample.xtend - 
3: com.google.common.base.Strings cannot be resolved to a type.
3    [main] ERROR e.compiler.batch.XtendBatchCompiler  - 
ERROR: 	MyExample.xtend - 
91: The method or field Strings is undefined for the type MyExample
3 [main] ERROR org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler  - 
ERROR: 	MyExample.xtend - 
91: The method or field Strings is undefined for the type MyExample
3    [main] ERROR e.compiler.batch.XtendBatchCompiler  - 
ERROR: 	MyExample.xtend - 
103: The method or field Strings is undefined for the type MyExample
3 [main] ERROR org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler  - 
ERROR: 	MyExample.xtend - 
103: The method or field Strings is undefined for the type MyExample
3    [main] ERROR e.compiler.batch.XtendBatchCompiler  - 
ERROR: 	MyExample.xtend - 
122: The method or field Strings is undefined for the type MyExample
3 [main] ERROR org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler  - 
ERROR: 	MyExample.xtend - 
122: The method or field Strings is undefined for the type MyExample
3    [main] ERROR e.compiler.batch.XtendBatchCompiler  - 
ERROR: 	MyExample.xtend - 
60: The method or field Strings is undefined for the type MyExample
3 [main] ERROR org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler  - 
ERROR: 	MyExample.xtend - 
60: The method or field Strings is undefined for the type MyExample


This Errors occure, because there is the import "import com.google.common.base.Strings" in MyExample.xtend. But in the project in which the files are located there is the dependency to com.google.guava (as said before, everything works fine locally).


I also tried to deactivate this class, then the XtendCompiler doesn't show any Error Messages. However the files are generated wrong, which leads to follow up Errors, when building the Projects. The generated files behave like described in this Bug:

Quote:
When the com.google.guava library is not present on the project class path, the xtend generator produces bogus code. e.g. instead of:

boolean _equals = Objects.equal(_source, "foo");

We get:

boolean _equals = void.equal(_source, "com.tasktop.ui");


An extract from the Error Message that I get, when building the Projects:

Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 52: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 59: DataSet cannot be resolved to a variable
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 59: The method filter(Iterable<EObject>, Class<DataSet>) is undefined for the type MyExample2
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 52: SensorInterface cannot be resolved to a variable
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 52: The method filter(EList<EObject>, Class<SensorInterface>) is undefined for the type MyExample2
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 55: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 55: SensorDataDescription cannot be resolved to a variable
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 55: The method filter(TreeIterator<EObject>, Class<SensorDataDescription>) is undefined for the type MyExample2
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 59: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 133: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 133: NonMeasurementData cannot be resolved to a variable
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 133: The method filter(EList<EObject>, Class<NonMeasurementData>) is undefined for the type MyExample2
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 143: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 143: MeasurementData cannot be resolved to a variable
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 143: The method filter(EList<EObject>, Class<MeasurementData>) is undefined for the type MyExample2
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 172: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 172: MeasurementData cannot be resolved to a variable
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 172: The method filter(EList<EObject>, Class<MeasurementData>) is undefined for the type MyExample2
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 187: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 187: NonMeasurementData cannot be resolved to a variable
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 187: The method filter(EList<EObject>, Class<NonMeasurementData>) is undefined for the type MyExample2
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 240: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 240: MeasurementData cannot be resolved to a variable
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 240: The method filter(EList<EObject>, Class<MeasurementData>) is undefined for the type MyExample2
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 260: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 260: NonMeasurementData cannot be resolved to a variable
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 260: The method filter(EList<EObject>, Class<NonMeasurementData>) is undefined for the type MyExample2
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 306: Syntax error on token "void", invalid Expression
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 348: Syntax error on token "void", invalid Expression
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 381: Syntax error on token "void", invalid Expression
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 459: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 459: Data cannot be resolved to a variable
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 459: The method filter(EList<EObject>, Class<Data>) is undefined for the type MyExample2
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 461: Syntax error on token "void", invalid Expression
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 465: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 471: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 477: Syntax error on token ".", class expected after this token
Error: file <<path to file in xtend-gen folder>>  MyExample2.java, line 491: Syntax error on token ".", class expected after this token


As I said before everything works fine, when tested locally, so my problem has to be with Buckminster. Is there any idea how to solve this problem or is this even a bug in buckminster?

When I deactivate all classes which use Google Guava or are generted by xtend with a Google Guava import the build works fine, so there has to be a problem with Google Guava. However the project has dependencies to "org.eclipse.xtext.xbase.lib" which provides com.google.guava and I even put the Google Guava plugin as a plugin project in the workspace and reference to it, so the dependencies should not be the problem.

I would appreciate your help.
Re: Buckminster can't resolve imports from Google Guava (Xtend) [message #1717016 is a reply to message #1716795] Wed, 09 December 2015 15:35 Go to previous message
Sven Eckhardt is currently offline Sven EckhardtFriend
Messages: 2
Registered: December 2015
Junior Member
It seems like there was a problem with the classpath. I put the guava jar file in the project und referenced it as library, it works now.
Previous Topic:Materialize Target Platform which includes the groovy-eclipse jdt feature patch
Next Topic:Problem resolving maven2 bundle
Goto Forum:
  


Current Time: Thu Oct 18 07:17:27 GMT 2018

Powered by FUDForum. Page generated in 0.02609 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top