Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrating Maven & Non-maven projects

Tags:

maven-2

I'm currently working on two projects simultaneously:

  • My main project (built with maven)
  • A spike of an open source project, which my main project depends on (not build with maven)

How do I set up maven to use the OSS project as a dependency with the least amount of friction, given that I'm often developing the two in tandem?

like image 698
Marty Pitt Avatar asked Oct 25 '09 14:10

Marty Pitt


People also ask

What is Maven integration?

Maven is actually a plugin execution framework where every task is actually done by plugins. Maven Plugins are generally used to − create jar file. create war file. compile code files.

Is Maven an integration tool?

Since Maven and Jenkins are two of the most frequently used build and integration tools in existence, a comparison between them is inevitable.

What is Maven integration test?

Maven is the most popular build tool in the Java space, while integration testing is an essential part of the development process. Therefore, it's a natural choice to configure and execute integration tests with Maven.


1 Answers

I can think of several solutions:

  1. Mavenize the existing OSS project. This is of course the "ideal" option but often not feasible (even if you introduce the new build system in parallel of the existing one). The project has likely an existing project structure that differs from Maven's standard layout. Changing the existing layout and build script may not be desired by developers, adapting a Maven build to use a non standard layout can be painful. In both case, you're screwed.

  2. Wrap the existing Ant build with Maven. This can be nice if you want to include the build of the OSS project in the lifecycle of your project and have both of them built in one step. You can check this answer on SO for details on how to do this.

  3. Use Apache Ivy or Maven Ant Task in the existing build to produce and install a Maven artifact in your local repository. Use this artifact as a regular dependency in your Maven project (except that you'll have to declare its transitive dependencies manually). This is maybe the quicker and less intrusive approach if building both project separately is not a problem.

It looks like you choose option 3. I think it's a good choice for a quick win.

like image 59
Pascal Thivent Avatar answered Oct 21 '22 05:10

Pascal Thivent