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...

 <repositories>
            <repository>
                    <id>lib-repo</id>
                    <name>lib-repository</name>
                    <url>file://${basedir}/lib</url>                
                    <releases>
                            <checksumPolicy>ignore</checksumPolicy>
                    </releases>
            </repository>
    </repositories>

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
2 ОТВЕТА
РЕШЕНИЕ

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

http://maven.apache.org/plugins/maven-install-plugin/examples/specific-local-repo.html

3
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:

<project>
  ...
  <distributionManagement>
    <repository>
      <id>projectRepository</id>
      <name>Repository Name</name>
      <url>Wagon Url</url>
    </repository>
  </distributionManagement>
  ...
</project>

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.

0
13.10.2009 22:42:02