Creating libs folder in maven

First of all, I must say that I understand that generally with Maven this is not how you should be doing something ...

What I'm looking for is how you will deploy the maven artifacts to a repository that exists in your project's lib folder. I know how to add the repository to my local filesystem in 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 get the artifacts in this "lib" folder. It's not as easy as dropping files, I have a feeling that I need to use the mvn install: install-file command somehow.

+2


source to share


2 answers


Looks like I can use this (I answered my own question pretty quickly, it looks like!).



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

+3


source


Do you mean deploy

or install

? In the maven dictionary, deployment adds an artifact to the remote repository and usually happens during a phase deploy

. This is done using the depoy plugin , which has two goals: deploy: deploy and deploy: deploy-file .

To use the plugin, declare where to deploy to pom.xml

by adding an item repository

below the itemdistributionManagement

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

      



About repository

:

  • id

    is a unique identifier for this repository (so you can refer to it in ~/.m2/settings.xml

    for authentication options).
  • name

    is the human-readable name for the repository.
  • url

    is the Wagon URL most often scp

    .

As you can see in the Wagon documentation, the wagon has a File . This allows Maven to use remote repositories stored on the local file system and also store Maven sites there. In other words, you can use file://C:\m2-repo

or file://${basedir}/lib

like url

.

0


source







All Articles