build maven project with propriatery libraries included

This question already has an answer here:

  • How to add local jar files to a Maven project? 23 answers

  • 1 Either you can include that jar in your classpath of application
    2 you can install particular jar file in your maven reopos by

    mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> 
        -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
    

    Possible solutions is put your dependencies in src/main/resources then in your pom :

    <dependency>
    groupId ...
    artifactId ...
    version ...
    <scope>system</scope>
    <systemPath>${project.basedir}/src/main/resources/yourJar.jar</systemPath>
    </dependency>
    

    Note: system dependencies are not copied into resulted jar/war
    (see How to include system dependencies in war built using maven)


    Create a repository folder under your project. Let's take

    ${project.basedir}/src/main/resources/repo
    

    Then, install your custom jar to this repo:

    mvn install:install-file -Dfile=[FILE_PATH] 
    -DgroupId=[GROUP] -DartifactId=[ARTIFACT] -Dversion=[VERS]  
    -Dpackaging=jar -DlocalRepositoryPath=[REPO_DIR]
    

    Lastly, add the following repo and dependency definitions to the projects pom.xml:

    <repositories>
        <repository>
            <id>project-repo</id>
            <url>file://${project.basedir}/src/main/resources/repo</url>
        </repository>
    </repositories>
    
    <dependencies>    
        <dependency>
            <groupId>[GROUP]</groupId>
            <artifactId>[ARTIFACT]</artifactId>
            <version>[VERS]</version>
        </dependency>
    </dependencies>
    
    链接地址: http://www.djcxy.com/p/29734.html

    上一篇: Maven并将JAR添加到系统范围

    下一篇: 与propriatery库包括建立maven项目