Advice on a good Java build tool, well integrated with eclipse
Asked Answered
P

6

6

I am working in a small team (3 persons) on several modules (about 10 currently). The compilation, integration and management of build versions is becoming more and more tedious. I am looking for a good build / integration tool to replace / complete Ant.

Here is the description of our current development environment : - Several modules depending on each over and on third party JARs - Some may export JARS, some export WARS, some export standalone, runnable JARS (with Fat-Jar) - Javadoc for all of them - We work with eclipse - Custom Ant script for each module. Many redundant information between the eclipse configuration and Ant scripts. For example, for the standalone Fat-JAR, we have listed all the recursive dependencies, whereas ideally, it could clearly be imported from the eclipse configuration. - The source code is versioned using SVN

Here is what I would like a perfect integration tool to do for me :

  • Automatize the releases and versioning of modules. Ideally, the integration tool should detect if a new version is needed. For example, if I want to release a project A that depends on a project B, and if I have made small changes on the project B locally, then the integration tool should first release a new version of B as well and make A based on it.

  • Integrate strongly with eclipse, so that it could get the dependencies between modules and third party libs from its configuration. BTW, I would like to continue to configure build path with eclipse without updating some other ".xml" stuff. I saw that Gradle can generate eclipse project files from its configuration, but the counterpart would be great.

  • Enable a "live" and transparent development on local projects. I mean that I often make small changes on the core / common projects while developing the main / "leaf" projects. I would like to have my changes on core projects immediately available to leaf projects without the need of publishing (even locally) the JARs of my core projects.

  • Store all versions of the releases of my module on an external server. The simplest (shares folder / Webdav) would be the best. A nice web page with list of modules and delivered artifacts would be great too.

I have looked around for many things. From Ant4eclipse (to integrate the Eclipse configuration into my Ant script), to the Maven / Ivy / Gradle tools.

I am a bit confused. Here is what I have understood so far: - Maven is a great / big tool, but is somewhat rigid and obliges you to bend to its structure and concepts. It is based on description rather than on scripting. If you go out of the path, you have to develop you own plugins. - Ivy is less powerful than maven, it handles less stuff but is more flexible. - Gradle is in-between. It is general purpose. It enables scripting as well as "convention based" configuration. It integrates Ant and extends it.

So at this point I am looking for actual testimonials from real users. What tools do you use ? How ? Do you have the same needs as me ? Does it ease your life or get into the way ?

Are there sample some use cases, or workspace skeletons out there that I could use as a starting point to see what these tools are capable of ?

Sorry for the length of this message. And thanks in advance for you advice.

Kind regards,

Raphael

Pesticide answered 6/7, 2010 at 13:5 Comment(2)
A build tool (like Ant, Ant+Ivy, Gradle, Maven 2, etc) or a Continuous Integration engine (like Hudson, CruiseControl, Bamboo, Teamcity, etc)? Build tools are not really CI tools (they can be used to implement a rudimentary CI process but I do not consider them as CI tools). You should maybe clarify.Interment
Yes you're right, it is not continuous integration that I needd, but rather build tool. I change that in the title.Pesticide
I
2

Automatize the releases and versioning of modules (...)

The concepts of versioning and repository are built-in with Maven and they could fit here.

Maven supports SNAPSHOT dependencies. When using a snapshot, Maven will periodically try to download the latest available snapshot from a repository when you run a build. SNAPSHOT are typically used when a project is under active development.

Maven 2 also supports version ranges (I do not really recommend them but that's another story) which allow for example to configure A to depend on version [4.0,) of B (any version greater than or equal to 4.0). If you build and release a new version of B, A would use it.

Integrate strongly with eclipse

The m2eclipse plugin provides bi-directional synchronization with Eclipse.

Enable a "live" and transparent development on local projects.

The m2eclipse plugin supports "workspace resolution": if project A depend on project B and if project B is in the workspace, you can configure A to depend on B sources and not on B.jar (that's the default mode if I'm not wrong). So a change on B sources would be directly visible, without the need to build B.jar.

Store all versions of the releases of my module on an external server.

As mentioned earlier, this is actually a central concept of Maven (you don't even have the choice) and deploying through file:// or dav:// are both supported.


To sum up, Maven is (probably) not the only candidate but I'm sure it would fit:

  • Your project isn't that exotic or complex, there is nothing scaring from your description (some refactoring of the structure will probably be required but this shouldn't be a big deal).
  • Maven also brings a workflow based on best practices.
  • m2eclipse provides strong integration with the IDE.

But Maven has some learning curve.

Interment answered 6/7, 2010 at 13:59 Comment(1)
does m2eclipse support bi-directional synchronization in the sense that if I update my project settings in eclipse (say add a extra source folder) will it then also add it to the pom.xml automatically ?Ratafia
T
2

CI tools? To me, there's only one: the Hudson CI.


I've setup a software development environment for Java once, with the components:

  • eclipse IDE
  • mercurial
  • bugzilla
  • maven
  • Nexus
  • Hudson CI

and some apache, mysql, php, perl, python, .. for integration.

The hudson was not integrated with eclipse and that was on purpose, because I wanted to build on a separate server. for all the other tools I had a perfect cross integration (like: mylyn on eclipse to talk with bugzilla, m2eclipse for using maven eclipse, a lot of plugins for hudson, ...)

Traffic answered 6/7, 2010 at 13:17 Comment(4)
Well, from what I see, "continuous integration" was probably not the right term. I do not need an external server to build source automatically / regularly for me. I just need to be able to push new releases of my modules from time to time on a shared server and to manage the dependencies.Pesticide
... thanks for changing the requirements after the work has been done ... ;)Traffic
Sorry for that. As a developer, you should be used to! ;)Pesticide
@Raphael - yes, you're right. And as a customer I got used to the fact, that companies adjusts their interpretation of the requirement to meet the product specs after the work is done ;-))Traffic
I
2

Automatize the releases and versioning of modules (...)

The concepts of versioning and repository are built-in with Maven and they could fit here.

Maven supports SNAPSHOT dependencies. When using a snapshot, Maven will periodically try to download the latest available snapshot from a repository when you run a build. SNAPSHOT are typically used when a project is under active development.

Maven 2 also supports version ranges (I do not really recommend them but that's another story) which allow for example to configure A to depend on version [4.0,) of B (any version greater than or equal to 4.0). If you build and release a new version of B, A would use it.

Integrate strongly with eclipse

The m2eclipse plugin provides bi-directional synchronization with Eclipse.

Enable a "live" and transparent development on local projects.

The m2eclipse plugin supports "workspace resolution": if project A depend on project B and if project B is in the workspace, you can configure A to depend on B sources and not on B.jar (that's the default mode if I'm not wrong). So a change on B sources would be directly visible, without the need to build B.jar.

Store all versions of the releases of my module on an external server.

As mentioned earlier, this is actually a central concept of Maven (you don't even have the choice) and deploying through file:// or dav:// are both supported.


To sum up, Maven is (probably) not the only candidate but I'm sure it would fit:

  • Your project isn't that exotic or complex, there is nothing scaring from your description (some refactoring of the structure will probably be required but this shouldn't be a big deal).
  • Maven also brings a workflow based on best practices.
  • m2eclipse provides strong integration with the IDE.

But Maven has some learning curve.

Interment answered 6/7, 2010 at 13:59 Comment(1)
does m2eclipse support bi-directional synchronization in the sense that if I update my project settings in eclipse (say add a extra source folder) will it then also add it to the pom.xml automatically ?Ratafia
B
2

We've been starting to integrate Gradle into our build process, and I can add to the answers posted already that Gradle would also work. Your assumptions are mostly correct, gradle is more off the cuff, but is powerful and allows for scripting and such within the build itself. It seems that most things maven can do, gradle does as well.

Now for your individual points:

Versioning: gradle supports dependency maps, versioning, and if you add in a CI server, you can trigger automated/dependent builds. For example, almost all of our 'deliverables' are .wars, but we have several code libs (.jars) and one executable .jar in development. One configuration is to make the the wars and the "fat-jar" dependent on the shared code libs. Then, when the shared libs are updated, bump the versions on the shared libs, test the consuming projects, then use Hudson's ability to fire dependent projects to redeploy those. There are other ways, but that seems to work best for us, for now.

Integrate strongly with eclipse: You're right, gradle can generate the eclipse files. We tend to only use the eclipseCp (to update .classpath) task once we get going, as only classpath needs changed. It's kind of quirky (grabs your default JRE, so make sure it's right, doesn't add exported="true" if you need it), but gets you 99% of the way there.

Enable a "live" and transparent development on local projects: This is one I'm not sure about. I've only hacked around gradle in this case; by removing the artifact in the consuming project and marked the shared project as such in eclipse, then reverted afterwards.

Store all versions of the releases of my module on an external server: simple and many approaches are supported, similar to Maven.

As far as examples, the docs for gradle are good, as well as the example projects that come with the full zip. They'll get you up and running fairly quickly.

Balance answered 6/7, 2010 at 16:59 Comment(2)
Unfortunately i did not found a good eclipse ide integration (auto completion, task list, mark errors, script wizard, etc.). Is there any one?Bestraddle
Cengiz, I've since moved back to a maven environment (changed jobs). But we would install the groovy plugin and tell it to match on .gradle files so we could at least get some syntax highlighting and such, as it is essentially groovy code. However, there is a plugin in the works (I think it depends on STS but you might be able to run it on vanilla eclipse too) static.springsource.org/sts/docs/2.7.0.M1/reference/html/gradle/…Balance
M
1

Have a look at Ant Ivy. http://ant.apache.org/ivy/

Mcmullan answered 6/7, 2010 at 13:49 Comment(0)
H
1

There are no silver bullets, but in my experience Maven is a great project management tool. Personally, I like to use a comibnation of subversion (for version control), maven (for project/build management) and hudson (for continuous build/integration).

I find the convention brought by maven is really useful for context switching, and great for dependency management. It can be frustrating if jars aren't in the repositories, but you can install them locally and when you're ready you can host your own private repository which mirrors other places. I have had a good experience using sonar.nexus by http://www.sonatype.com/ . They also provide an excellenmt free book to get you started.

It might seem like overkill now, but setting up a good build / test / integrate / release environment now, will pay dividends later. It's is always harder to retro-fit, and it's something you can replicate easily.

Lastly, I happen to prefer Netbeans integration for maven, but that's just me :)

Hydrolytic answered 6/7, 2010 at 14:58 Comment(0)
A
0

Some of your topics are part of deployment and release management.

You could check out a product like: Xebia DeployIt
(with an personal edition which is free)

Amoakuh answered 6/7, 2010 at 13:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.