Creating a libs folder in maven

First of all I should state that I understand that typically with Maven this is not how you should do things...

What I am looking for is how you would deploy maven artifacts to a repository existing in the lib folder of your project. I know how to add a repository on my local filesystem to pom.xml like this...


The confusing part is how I would get artifacts in to this "lib" folder. It's not as simply as dropping in files, I have the feeling I need to use the mvn install:install-file command somehow.

13.10.2009 18:10:18
Do you mean deploy like deploy:deploy or install like install:install-file?
Pascal Thivent 13.10.2009 19:42:24

It looks like I can use this (I answered my own question rather fast it seems!).

13.10.2009 18:11:00

Do you mean deploy or install? In maven's vocabulary, deploying is adding your artifact(s) to a remote repository and typically occurs during the deploy phase. This is done using the depoy plugin that has two goals: deploy:deploy and deploy:deploy-file.

To use the plugin, declare where to deploy to the pom.xml by adding a repository element under the distributionManagement element:

      <name>Repository Name</name>
      <url>Wagon Url</url>

About the repository:

  • The id is a unique id for this repository (so you can refer to it in ~/.m2/settings.xml for authentication settings).
  • The name is a human-readable name for the repository.
  • The url is a Wagon URL, most often scp.

As you can see in Wagon's documentation, wagon has a File provider too. It enables Maven to use remote repositories stored in local file system and to store Maven sites there also. In other words, you can use file://C:\m2-repo or file://${basedir}/lib as url.

13.10.2009 22:42:02