How to create a Maven Artifact, from lonely *.jar files?
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.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>
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
- Maven: add a dependency to a jar by relative path
mvn install:install-file did the trick: Install-File
精彩评论