views:

35

answers:

2

Hey,

I'm using Eclipse to manage my SVN repository, and I have a few projects that depend on the same Jar files, I would like to create a maven artifact of these Jars (if possible using Eclipse) and commit that artifact into my SVN repository for further use.
How can I achieve that?

Thanks,
Adam.

+2  A: 

Create an Eclipse project which contains all the JARs and an ANT build.xml which calls mvn file:install for each JAR to install then in your local Maven repository (see the docs for options of mvn file:install).

That way, you can use these JARs like any other Maven dependency after running the build.xml once.

[EDIT] A sample target would look like this:

<target name="maven-file-install">
  <exec executable="mvn"> <!-- Make sure mvn is in the PATH -->
    <arg value="file:install"/>
    <arg value="-Dfile=your-artifact-1.0.jar"/>
    ... all the other arguments of file:install ...
  </exec>
</target>
Aaron Digulla
I do understand what I need to do, but I have never used maven in the XML form, so I actually don't know hoe the build.xml should look like, could you add a short example please, I'm sure I'll be able to take it from there... Thanks.
TacB0sS
It's really simple; I've added an example.
Aaron Digulla
I like this approach, I'll give it a go right a way
TacB0sS
+1  A: 

I suggest using a file based repository:

  • Create a module containing a file based repository
  • Install the jars in this file based repository
  • Commit the module to SVN

Detailed steps are provided in this previous answer.

Similar questions

Pascal Thivent
When you say module you refer to the folder containing the "maven-metadata-local.xml" that was generated?
TacB0sS
I also need to add native library, is it possible?
TacB0sS
@TacB0sS: No, I mean a maven project.
Pascal Thivent