maven uses local jar package

Some projects will use some jar packages that are not available in the Maven library, so we need to introduce them ourselves

There are two ways to do this:

The first way, use the local path when referencing in the pom file:

First put the jar package into the project:

Then introduce in the pom file:

copy code
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>sdk.core</artifactId>
            <version>3.3.1</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/lib/aliyun-java-sdk-core-3.3.1.jar</systemPath>
        </dependency>
copy code

Notice:

1.添加 <scope>system</scope>

2.systemPath This path is the path of the jar package. ${project.basedir} is just a system own constant.

The second way, use maven to add the jar package to the repository path under .m2

mvn install:install-file -Dfile=jar package location -DgroupId=groupId above -DartifactId=artifactId above -Dversion=version above -Dpackaging=jar

This method requires maven to be installed and configured on the computer

Reprinted in: http://www.cnblogs.com/jiangwz/p/8808829.html

Some projects will use some jar packages that are not available in the Maven library, so we need to introduce them ourselves

There are two ways to do this:

The first way, use the local path when referencing in the pom file:

First put the jar package into the project:

Then introduce in the pom file:

copy code
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>sdk.core</artifactId>
            <version>3.3.1</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/lib/aliyun-java-sdk-core-3.3.1.jar</systemPath>
        </dependency>
copy code

Notice:

1.添加 <scope>system</scope>

2.systemPath This path is the path of the jar package. ${project.basedir} is just a system own constant.

The second way, use maven to add the jar package to the repository path under .m2

mvn install:install-file -Dfile=jar package location -DgroupId=groupId above -DartifactId=artifactId above -Dversion=version above -Dpackaging=jar

This method requires maven to be installed and configured on the computer

Reprinted in: http://www.cnblogs.com/jiangwz/p/8808829.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325244737&siteId=291194637