Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

disable checking syntax(When using ant with Eclipse)

 
Xu Song
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
A simple project,the external jar file is specified with CLASSPATH variable in the project's build.xml file.So the build can work well.But the Eclipse JDT still perform the checking syntax operation:There's red cross error sign at the "import my.lib.*" line.
Question:How can I disable the checking syntax(I don't want to add external jars in the project properties tab,since it's already specified in build.xml)?

Regards,
Xu Song
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34087
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Xu,
If you are using Eclipse (with or without ant), you need the code to compile in Eclipse. As you mentioned, you can do this be adding a jar to the build path.

If you do not need the code to compile in Eclipse, you can use Ant standalone.
 
Xu Song
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne,
I'm using ant in Eclipse for the sample project.All ant build tasks(like compile,clean,dist) are executed successfully in the Eclipse Ant View.But in the java source file editor,Eclipse still prompt me:The import my.lib.* cannot be resolved.
If I migrate one Java project into Eclipse,should I add tens of external jars into Eclipse project properties by hand(Even though I completely use Eclipse ant view to build the project)?

Xu Song
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34087
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Xu,
Now I see what you are trying to do. You can actually turn off the Eclipse build, since you are using Ant. And in project level preferences, remove the java builder from the list of external builders. (You could replace this with your ant build if you want or just delete it.) Then Eclipse will no longer attempt to compile.
 
Xu Song
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne,
That's exactly the way I have tried.In project level preferences,I uncheck "Java Builder" in 'Builders config table'(it's impossible to remove),and new an 'ant builder'.I confirm I've disabled the 'Build automatically' option as well.
But it still reports:"The import my.lib cannot be resolved".

Regards,
Xu Song
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34087
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Xu,
I think it might be remembering from a previous compile. Try deleting the .class files and rebuilding with Ant.
 
Xu Song
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne,
Triled but failed again.
I checked the help document:Workbench User Guide-->Ant & external tools tutorial-->Use cases for Ant in Eclise-->Ant buildfiles as project builder-->Creating a project builder Ant buildfile.
I can find in last paragraph of this page:"internal Eclipse Java compiler which in turn is responsible for indexing your source so that searching, refactoring and many other features are available. Thus it is not possible to replace the internal Eclipse Java compiler by using a project builder".
It seems that the default Java Builder is always mandatory though the last line in the page says 'you can disable the Java Builder'.
Anyway,my decision:Come back to the jEdit's ant plugin.Currently flexibility is more convenient than integration for me(compare jEdit with Eclipse).
Thanks a lot for your comments.

Regards,
Xu Song
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic