How to refresh a eclipse project built from ant build file? - eclipse

I created a new project in eclipse using an existing ant build file (using the eclipse feature).
Is there a way to refresh the project, if the ant build file is modified?
For example, there were new build path dependencies added to the build.xml but in eclipse those files were not added to the project build path.

I believe once the project has been created you have to keep them up to sync manually. Either that, or delete the project in eclipse and create a New project from the newly updated ant file.

Related

Where are the eclipse product build scripts stored?

i'm exporting an eclipse product with the eclipse Product export wizard. when i run this wizard a lot of build scripts are generated and executed - i want to re-use these build scripts for my p2e-build. where does eclipse store these build scripts?
The files for the build are created in the root folder of the project containing the xxx.product file you are using. They only exist while the build is running. The main file is a build.xml Ant script.

How to generate build file for project in Netbeans

I know eclipse can automatically create a build file for a given project through its inbuilt wizard (Export->General->Ant File).
But wondering how to do the same if my project is in Netbeans.
Does NetBeans also provide a similar wizard screen to create build file. If not, any other way around.?
NetBeans uses Ant as its build system. Ant build script is already there (unless you used Maven project type).
Some related questions are linked in How do I build ant's build.xml using NetBeans?
I could not find to create build file from Netbeans. But found a workaround, by creating a build for my project in eclipse and then modifying it to suit to netbeans project structure.

Automatic Build for Non-Java Eclipse Project

I have a project that contains xml files. I also have an Ant build in that project to generate documentation based on the xml files. The Ant build calls a Ruby script for generation.
I would like a way run that Ant build after the modification of any resource in the "{project}/xml" folder. I know that I can right click on the build.xml and Run As->Ant Build, but I want it to be more like the incremental build for Java projects. I have tried creating a builder, importing the Ant build and setting up relevant resources, but when I make a change to the XML file, a build does not start. I have "Build Automatically" checked for the project as well.
This must be possible. What am I missing?
A custom builder will only run when a file is saved that is in a source directory. Make sure the /xml folder is included as a source location in the Project Properties, Java Build Path.

How to integrate maven 2 in an existing netbeans project?

How to integrate maven 2 in an existing netbeans project ?
I dont want to do it by creating a new maven web app project and moving my files manually to
the new project(as I have versions of this project in my subversion repositories which I wont be able to link if I create new project), rather I need to integrate that in my already existing netbeans project. How do I go about it ? Would creating a pom.xml work ?
Maven 2 already installed on my machine.
What about creating a new Maven Web Project and moving the pom.xml back to your existing Web Project? I mean:
Backup your projects
Create a new project with name MavenWebTest
Close your original project
Move the pom.xml from the MavenWebTest project to your original project's folder
Modify the pom.xml's project specific settings (e.g. project name, dependencies)
Delete the build.xml and the whole nbproject folder
Move and rename the web folder to src/main/webapp (webapp is the new name) (use svn mv if you use Subversion)
Move src/java to src/main/java (svn mv here too)
Open you project again in Netbeans. It should be a Maven project now.
Delete the unnecessary MavenWebTest project
Anyway, creating an empty pom.xml also should work. You have to list your dependencies in the pom.xml and you have to set the project's name. Maybe other fine tunings also required to get the same result as Netbeans create without Maven. If you create the pom.xml with Netbeans (the MavenWebTest above) I suppose that most of Netbeans specific stuff already will be there.
If you are new to Maven I suggest you to check the free pdf/html books on Sonatype's website.

NetBeans -- Is it possible to bypass the IDE-generated Ant build for an existing project?

I have a Java project with sub-projects that is currently built using NetBeans's IDE-generated Ant scripts. I am converting the entire project to a Maven build.
My Maven build works fine from the command line and loads perfectly in Eclipse. However, the only way I can get the project to load as a Maven project in NetBeans is to delete the Ant scripts, i.e. build.xml and the directory nbproject for each sub-project. It seems that as long as I have the old IDE-generated build files, NetBeans recognizes the project as a NetBeans Java project only, not as a Maven Java project, even though there is also a pom.xml file present.
Short of deleting the IDE-generated build files, is there any way to tell NetBeans to load the project as a Maven project?
I have been told that we want to keep the Ant build for a while during the transition to Maven.
Using NetBeans 6.9.1, Maven 2.2.
Any help would be appreciated.
Thanks
Well, the nb ant project metadata has precedence over occurence of pom.xml file (that's how maven projects are recognized and loaded). The whole precedence order hardwired in the IDE, you could only influence it be uninstalling the j2se ant project type for example.
So, yes. You need to get rid of the ant project metadata before you can open the project as maven project. Depending on how and when you delete the metadata, you might need to restart the IDE as well to get the new stuff loaded.
Have you seen http://wiki.netbeans.org/MavenBestPractices? It indicates that you must install the NetBeans maven plugin first. Perhaps that's why your Maven projects aren't recognized.
I must note that I'm not a NetBeans user anymore!
Here is what I ended up doing:
I wrote an Ant script (ironic, huh?) that, for every subproject of my project, renames the file nbproject/project.xml if it exists to nbproject/nb_project_disabled.xml. If nbproject/nb_project_disabled.xml exists instead, the script renames it back to nbproject/project.xml. In this way, the script toggles the opening of the project as a NetBeans Ant build or as a Maven build.
It would be nice if NetBeans, you know, had a setting to open both kinds of projects. Currently (6.9.1), there is just the "Open Project" command. In Eclipse, there is the command "Import Existing Maven Projects" vs. "Import Existing Project Into Workspace" (i.e. native Eclipse format).