I have a series of Eclipse projects containing a number of plugins and features that are checked into CVS. I now need to run an automated build of these plugins. Ideally I'd like to do it without having to hardcode large numbers of Eclipse library locations by hand, which has been the problem with the automatically generated Ant files that Eclipse provides. The build also needs to run headlessly.
Does anyone have experience of this sort of set-up with Eclipse, and recommendations for how to achieve it?
There are a few options for you to look at, depending on which build scripting language you're using:
For Maven2, the way forward seems to be Spring Dynamic Modules. Other options are Pax Construct, m2eclipse, Maven BND
For Ant/Gant, Eclipse PDE Build, Ant4Eclipse
For command line or both the above, Buckminster.
At my current clients we use Buckminster, which wraps PDE-Build, and call it from Ant/CruiseControl. We've got code coming in from multiple repositories all being built into a single RCP product.
Also, these questions may be of help.
The standard way to make an Eclipse Build is to use the PDE Build Plugin.
http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.pde.doc.user/guide/tasks/pde_feature_build.htm
http://wiki.eclipse.org/index.php/PDEBuild
The PDU plugin is normally included with the Eclipse IDE and contains a series of templates. The templates help you set up a system that will:
fetch: Checkout all plugins and features using a map file, that contains the locations of the plugins
generate: Creates a build process for every plugin checked out
process: Compiles the plugins
assamble: Jars and packs the plugins
postBuild: Allows to set up automatic tests and deployment
Theoretically all you need to do is to modify a customTargets.xml file , write a map file that contains a reference to every plugin that you need to check out and modify a build.properties file to indicate such properties as the cvs server location.
I had a similar problem to the one you have. The build mechanism is divided into several steps. You can customize the preFetch target of the customTargets.xml file so some "bulk" libraries are imported from specific trees in the repository and add them to the build directory, so you don't have to specify every single plugin in the map.
You can use Tycho to build your eclipse plugins with Maven. This is how the M2eclipse plugin is built. Find out more at http://m2eclipse.sonatype.org
You could write some sort of a script that finds those libraries for you and puts them into a format understandable by Ant.
For example, it could build a eclipse.lirbaries.properties file, then you could read in that file using:
<property file="eclipse.libraries.properties" />
You could also use the FileSet attribute:
http://ant.apache.org/manual/Types/fileset.html
Or even a combination of both.
1) Call Ant Script
2) Ant Script calls bash (or whatever scripting language) script which builds eclipse.libraries.properties
3) Ant loads eclipse.libraries.properties
4) Ant goes on with the build
Related
Possible to execute Java Maven Project in MS TFS?
I have linked the project inside MS TFS using the POM file but it dosnt seem to open any browser(s) instances.
My POM file has a surefire pluging used to execute the TestNG xml but that dosnt seem to work,
The tests run too quickly and the results are inconsitent, is this even possible?
Thanks for your help
Use your build server to make life easier. The easiest way to create a build definition for a Maven build is to use Eclipse with the TFS plugin. You connect to your project, create a new build definition, choose Maven, and it will construct a TFSBuild.proj file (yes, the really old Upgrade Template). At the very bottom of that tfsbuild.proj file, you'll need to edit to look something like this:
Note the "Goals" entry - this can be modified to your specific goal.
In the build definition, the Configuration Folder Path will have the value of the location of your TFSBuild.Proj file - just the folder. By default, it will be created in $/YourProject/TeamBuildTypes/YourBuildName. In Source Settings, the location of the POM file is mapped to $(SourceDir).
If you are using the TFS2015 or later with vNext build system, you can refer to this link for detailed steps: Build your Java app with Maven.
I have two things that I want to do that seem like they are in conflict with each other. On the one hand, I would like to use IntelliJ's GUI interface to manage my project's configuration and so I would like to put the metadata in its version-controlled repository. On the other hand, I want the result of my work to be a repository that does not require the end-user to have IntelliJ, so I not only want there to be no metadata in the repository I publish, but in its place I want to have files that provide some standard Java build system in their place. Is there a convenient way to let me have both of these things?
IntelliJ lets you use tools like Ant or Maven for its builds, and provides a nice GUI for interfacing with them. And anyone without the tool can just use Ant or Maven to run the builds from the command line. You'll either have a build.xml (for Ant) or a pom.xml (for Maven) as part of your source tree.
If you're not going to check in the Intellij project configuration, I recommend setting up a configuration-directory-based project then just set up your version control to ignore the .idea directory. Personally, I consider my project configuration to practically be source code, so I tend to check in everything except my .idea/workspace.xml file. As long as I'm using Ant or Maven to do the builds, people without IntelliJ can still build the project fine.
Sourceforge.net has a filter for Java projects, but I'm looking for a way to narrow them down to ones that are meant to be built in Eclipse.
Edit I'm using Eclipse Metrics and Omondo plug-ins to analyze open-source Java projects. I'm looking for a quick way to find Eclipse open-source projects that can build quickly in Eclipse, so I can use these tools on them for analysis.
I presume that a project that is "meant to be built in Eclipse" is one that has an Eclipse .project file and other stuff checked into the source repository.
First, checking in Eclipse-specific stuff can a bad idea because it is easy to include stuff (e.g. build pathnames, preferences) that are specific to the developer. You then get problems if there are multiple committers ...
Second, this should unnecessary. Most of the stuff in the .project file can be generated when you import the project. If that's not possible, then the project should provide instructions for setting up the buildpath etcetera. (Note that if the project uses Maven, this is all taken care of for you.)
Third, any project worth its salt will include build scripts of some kind that allow you to rebuild without using any IDE.
Finally, any project that only supports building using Eclipse is excluding the significant subset of developers who use other Java IDEs.
Note that neither Maven or Ant builds require Eclipse to work. Both of these build tools can run from the command line, or from other Java IDEs.
OK. I understand your requirements now. You don't actually care what the project is ... or that it is sound / worthwhile project. You just need it for testing your plugin. (I won't comment on the "validity" of doing this. It depends on what you hope to achieve.)
I suggest that you install the m2eclipse plugin and look for projects with a "pom.xml" file. The projects don't need to be eclipse specific. The m2eclipse plugin automatically creates the ".project", ".classpath" and so on based on the "pom.xml" file. There's no need to exclude any particular version control system, because the m2eclipse plugin can import Maven projects that you checked out from the command line.
It is the following situation:
I currently have multiple Java projects in Eclipse. All the sources, build files etc are checked in at a repository. If a new team member joins the project he has to rebuild the complete setup (setting build path dependencies, adding special libraries).
I thought if that could be automatically done some way, e.g. using an ant file to do all the configurations of eclipse or the servers (tomcat).
Anyone ever found a solution for this?
Check in the .classpath and .project files and you should be set!
(More information about the .project file.)
I believe that you might use Maven too.
But that would require quite an adjustment, I believe.
Step two of "The Joel Test: 12 Steps to Better Code" states "Can you make a build in one step?". My answer to this is currently no. My application is structured as follows:
+
+-MyApp // this is just a vanilla Java Application
+-MyWebApp // this Dynamic Java Web Application (deployed Tomcat and launches
// a thread contained in MyApp)
+-MyCommonStuff // these are common classes shared between MyApp and MyWebApp
// Ex. Database access code & business classes
In order to build and deploy my software I perform the following steps:
1. Checkout MyApp, MyWebApp, MyCommonStuff from svn
2. build MyCommonStuff.jar and copy to a "libs" directory
3. build MyApp and copy to a "libs" directory
4. build MyWebApp.war (Ant build.xml file specifies where MyApp.jar and MyCommonStuff.jar are located)
5. The deploy portion of build.xml used Tomcat deployment tasks to deploy to a tomcat server.
My question is does the Joel rule above apply to this scenario. i.e. should there be a "master" build script which executes steps 1. to 5.?
Should the script just be a normal #/bin/sh script or are there tools I can leverage. My preference would be stick to using Ant and linux console commands.
Thanks
You can (and should) use maven2. It supports everything required (via plugins). You just need to conform to its directory conventions.
In addition I'd suggest a Continous Integration Engine, which will take your maven configuration and execute and deploy everything. Hudson and TeamCity are good options.
An alternative to Maven, if you just want to use Ant, is Ivy. This is just a dependency manager, a bit like Maven but without all the other stuff Maven does.
I would suggest using one of the two. If you have a project with dependencies like this, you're going to make it so much easier for yourself if you store them in a central repository and use a dependency manager to include them!
You should do a global Ant script, calling all little ant parts through the Ant ant task.
Edit after reading other answers : you should also use maven. But if Maven is really overkill, and you just want to launch the whole build in one step, use a global build.xml