简体   繁体   中英

Controlling jar name from internal repository maven

I have created an internal repository(Libs) and places my jars in folder hierarchy as showed below

在此处输入图片说明

here is my POM where i am creating repository and specifying dependency for common-jar-1.0.jar

<repositories>
    <repository>
        <id>in-project</id>
        <name>In Project Repo</name>
        <url>file://${basedir}/libs</url>
    </repository>
</repositories>

<dependencies>

    <dependency>
        <groupId>common</groupId>
        <artifactId>common-jar</artifactId>
        <version>1.0</version>
    </dependency>

    <dependency>
        <groupId>mediator</groupId>
        <artifactId>mediator-jar</artifactId>
        <version>1.0</version>
    </dependency>

</dependencies>

I want my POM to accept my jar with name common.jar ,how can i do it.

currently it will accept only common-jar-1.0.jar , can we exclude the version from jar name some how?? Please Help

The following will install the common.jar with version 1.0 into the local repository ~/.m2/repository

mvn install:install-file -Dfile=<path to common.jar> -DgroupId=common -DartifactId=common-jar -Dversion=1.0 -Dpackaging=jar

after that you can define the dependency as usual

<dependency>
    <groupId>common</groupId>
    <artifactId>common-jar</artifactId>
    <version>1.0</version>
</dependency>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM