user1829716
user1829716

Reputation: 307

Is Maven a good solution for my Application

I'm developing on an java application that consists on a main-application that is loading extensions (jars) at runtime. Each extension is a java project. all jars have the main application in class path and other libraries. The manifest of the main application also has dependencies in the manifest classpath, e.g. sqldriver, poi,log4j etc.

Everytime I change on of the lib, i have to set all classpaths of the projects. Also if i want to build all the jars, i have to export each project once. So I thought maybe is Maven a good solution for me. So I've installed m2eclipse and converted the projects to maven projects.

But for now i have for each projekt an own pom.xml and i also have to build all projects once. I'm new to Maven and searching for best practises for my problem. So I'll thank you for your help and advice

Upvotes: 0

Views: 142

Answers (3)

Mikkel Løkke
Mikkel Løkke

Reputation: 3749

Unless you really, really need OSGi , Maven is great. If you're doing OSGi maven is less great.

M2eclipse however is less helpful, and in my experience only leads to confusing headaches.

How you should build your projects depends on a few things. I agree that the submodule approach described in the other answers is best-practice, and if all your sub-module candidates are related (for instance, each represents a tier in a n-tiered application), in the same SCM repository, and the interfaces change often, and the versions are co-dependant then by all means, you should do that.

If however your submodules are stand-alone and don't have a lot of transitive dependencies, particularly if they are in separate SCM repositories, they are independently versioned, and you have a little spare hardware for a build server (like say Hudson) and a Maven2 artifactory (like Sonatype Nexus), you could just keep them as seperate projects, and let maven handle the rest. This way you avoid having to re-build everything because you made a small change in one of the submodules. You can just build that one.

Upvotes: 0

Diana Amza
Diana Amza

Reputation: 303

You can use a hierarchy for your pom files. Here's an older question (similar to yours) that has a great example in the answers: Maven: POM modules and submodules hierarchy

Basically this structure:

<project>
  <parent>...
  </parent>    
  <artifactId>module</artifactId>
  <packaging>pom</packaging>

  <name>Module</name>

  <modules>
      <module>submodule</module>      
  </modules>
  (...)
</project>

in a 'root' pom.xml file, besides the actual submodule pom.xml files.

Upvotes: 0

Andres
Andres

Reputation: 10717

Make all your projects modules of one parent pom project. This way you can build them all at the same time.

Upvotes: 4

Related Questions