This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes disable checking syntax(When using ant with Eclipse) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "disable checking syntax(When using ant with Eclipse)" Watch "disable checking syntax(When using ant with Eclipse)" New topic
Author

disable checking syntax(When using ant with Eclipse)

Xu Song
Greenhorn

Joined: Nov 16, 2001
Posts: 20
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30057
    
149

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Xu Song
Greenhorn

Joined: Nov 16, 2001
Posts: 20
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30057
    
149

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

Joined: Nov 16, 2001
Posts: 20
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30057
    
149

Xu,
I think it might be remembering from a previous compile. Try deleting the .class files and rebuilding with Ant.
Xu Song
Greenhorn

Joined: Nov 16, 2001
Posts: 20
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: disable checking syntax(When using ant with Eclipse)
 
Similar Threads
JBoss tutorial wscompile issue
How to auto deploy webproject using build.xml into Eclipse
Ant integration with Eclipse [Build.Properties]
Class bytes found but defineClass() failed
Building JAR's for linked projects...