How to use code assist in Eclipse with ant - eclipse

Usually when we use Eclipse IDE, it can assist us with related functions/variables, checking the compilation errors automatically.
Now I want to use Ant to manage the compilation and deployment process. After adding import instruction in build.xml, I can compile and run it with an Ant builder. But the problem is, when coding, the Eclipse editor cannot give code suggestions and always complains that I don't import some libraries which added in build.xml.
How to make the Eclipse editor give code suggestion and checking compilation errors based on settings in build.xml with a ant builder?

My version of eclipse works fine for code completion and syntax checking. Maybe yours is turned off? Check under Window > Preferences > Ant > Editor and then on the Problems tab make sure that 'Ignore all buildfile problems' is turned off.
There are also some content assist options around that area - mine are all turned on.
I'm using SCS 2.5.0.RELEASE, which sits on top of eclipse 3.6.1.r361

Related

Eclipse + GWT 2.8.1. : Changes to *.ui.xml files don't show up although super dev mode is active

When I change a ui.xml file (e.g. change css styles), these changes don't show up in the application.
The only way to get the changes visible is in Eclipse to choose
Project-> Clean ... and to remove and recompile the whole project.
My settings:
-noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -war "${workspace_loc:NewComApp/war}" -codeServerPort 9998 com.myapp.MyApp
My tomcat (alhtough I understand that this does not influence the superdevmode):
Anyone experiencing the same problem.
This makes iterations during development very slow, because compiling the whole project because of some minor changes to the layout seems ridiculous.
The ui.xml files are located in the same package as the java source files:
Any advice on this?
After a lot of research and a little help from a friend I want to describe the solution.
First of all you need to understand that SuperDevMode (like DevMode) translates what it finds on the classpath of the JVM where the SuperDevMode runs.
So for the solution in Eclipse it is necessary to point the classpath to the source directory.
For this you need to open the config dialog of your SuperDevMode:
Means make super sure that your source comes first!!
Means that you must make sure all your project and libs are available
For 2. You need to open "Java Build Path" select "Order and Export" your Project Properties in Eclipse.
After that you you just hit F5 in eclipse to see any changes (ui.xml or java code) instantly compiled by SuperDevMode compiler instead of Eclipse Project Build compiler
Along with a tomcat installation this lots of time.

Eclipse code error marks does not auto-refresh

I am working with Eclipse Photon 4.8.0 and I'm facing a weird behaviour when I'm working with Java files.
When I make a change in a file, usually Eclipse refresh the code reviewer automatically, marking errors and warnings on the fly in the code. This is not happening to me. The code marks appears or disappears only when I save the file.
I suppose there is some preference option to allow auto-refresh for this code checks, but I can't find it.
In Window > Preferences: Java > Editor check the checkbox Report problems as you type.
I think that actually it's not a fix for the problem, but I delete this Eclipse and downloaded Eclipse Oxygen. Now it works. I suppose it's a bug for the new Eclipse Photon.

understand complex ant build files

I have a quite complex ant build system comprised of many build.xml files in different folders. I want to crack on it.
Is there any IDE support (in Eclipse or Intellij) for me to jump to target definitions, taskdefs' definitions, macrodefs' etc.?
Besides "ant -v", any other way to ease the understanding of the flow of target execution?
Thank you.
In 2007, I wrote an article on the options to display Ant targets and dependencies visually. I think they will still work. I also had to deal with a large Ant codebase and the visualization really helped. (I used a tiny Ant build for the article but the tools do scale well.)
The default eclipse distribution contains an Ant XML Editor which helps navigating Ant files. Simply right click the Ant file and select "open with -> Other -> Ant Editor".
You can jump to target definitions by pressing CTRL and clicking on it. You can also set breakpoints in your ant scripts. If you start the ant script in debug mode from eclipse, execution will stop at your breakpoints and you can debug your ant script like you would any other code.

Eclipse adding your own build command

I am new to eclipse and wanted to do the following:
Use my custom build commands with eclipse. Until now I only saw make all. I use a shell script for building my project; how can I use that in an Eclipse environment?
When I create a new project with the existing source code, it doesn't add the files, without building the code and if code fails to build (because I generally don't have make all).
How do I resolve this issue?
You can add a custom builder in the "Builders" category of the project properties.
project->properties->builders->new
there you can also deactivate the default eclipse builders..
hope that helped
In addition to what smeg4brains said and assuming that you are using the CDT plugin you can go to:
project -> properties -> C/C++ Build
Uncheck Use default build command on the Builder Settings tab and replace make with e.g. scons.
On the Behaviour tab you can then specify the target to call for the Build and Clean phase.
To resolve your second issue open the Project menu and uncheck Build automatically.
This will prevent Eclipse from building the project when it thinks it is necessary.
If you want to add other your own commands then the easiest way is to write Ant file for your project so by clicking once you can execute all your commands.To see how to write Ant file click here
I was able to do something similar to have protoc run on my .proto files. I did it by adding a "Make Target" to the project.
A lot of stuff in Eclipse you can get around using Ant, which are XML scripts, and there is also a ANT project builder which uses those. If you don't like to mess with frankly quite touchy GUI options, just write a build.xml and use ANT build as the project builder.

Ant build consoles get clobbered by dependent projects in Eclipse

I have a set of dependent projects in Eclipse, each with its own Ant build script. If I make a change in multiple projects, then select "Build All" (Ctrl+B), each Ant build is invoked in the correct order. But if there is an error in one project, Eclipse still tries to build the other projects also, and in the process clobbers the Ant console so that the build errors are no longer visible. This wouldn't be quite so annoying if I could open up the offending project and select "Build Project", but Eclipse out-smarts me: it won't rebuild until I open some file in the project, edit it, and save (typically I add and remove a space character wherever my cursor happens to be). An answer to any of the following questions would be welcome.
How can I configure Eclipse to (in preference order):
terminate a "Build All" as soon as any project's Ant build fails?
save all console output for "Build All" instead of resetting the console for each project?
spawn a separate console for each new instance of Ant?
allow me to force a "Build Project" even if it doesn't think anything has changed?
[UPDATE] Bonus Question:
How can I configure Eclipse so that fixing any build errors in a depended-on project counts as a "change" for the purposes of "Build Project"?
Have you tried redirecting standard out to file via a run configuration? A few screen shots to help if not... (you may try 'append' this is not in my screen shot :) )
One alternative is to have each Ant build log itself, e.g., using the following in build.xml
<record name="build.log"
loglevel="verbose"
append="false" />
Oddly, Eclipse seems to disable this logging somehow when running an Ant build.
I am not too big on ant, but can't you make the builds dependent on one another?