Maven Systempath未按预期工作
我在pom.xml中指定了以下依赖项(例如这里提到的一个),它将在指定的sytempath和Maven下查找saaj.jar,用于从同一路径中选择saaj.jar并正常工作Maven Systempath未按预期工作,maven,Maven,我在pom.xml中指定了以下依赖项(例如这里提到的一个),它将在指定的sytempath和Maven下查找saaj.jar,用于从同一路径中选择saaj.jar并正常工作 <dependency> <groupId>saaj</groupId> <artifactId>saaj</artifactId> <version>1.0</version> <scope>system</scope&g
<dependency>
<groupId>saaj</groupId>
<artifactId>saaj</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/saaj.jar</systemPath>
</dependency>
现在,它在${basedir}/src/main/webapp/WEB-INF/lib/saaj/saaj/1.0/而不是${basedir}/src/main/webapp/WEB-INF/lib/文件夹下寻找saaj-1.0.jar而不是saaj.jar
为什么会这样?请提供解决方案,我以前的设置应该可以正常工作。不要使用
系统
范围。它是为系统提供的图书馆设计的。根据您为它提供的路径,显然您正在创建一个web应用程序
使用war项目,如果依赖项已经可用(例如,因为它们是由应用程序服务器提供的),则使用提供的
范围指定依赖项,否则不指定范围规范。Maven将负责以正确的方式打包您的项目依赖项,用于Eclipse开发和应用程序服务器中的部署。为了避免systemPath,您必须创建一个本地存储库,如:
这是您的pom文件:
<repositories>
<repository>
<id>local-repo</id>
<url>file://${basedir}/lib</url>
</repository>
</repositories>
<dependency>
<groupId>tiago.medici</groupId>
<artifactId>eureka</artifactId>
<version>0.0.1</version>
</dependency>
tiago.medici-0.0.1.pom
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>tiago.medici</groupId>
<artifactId>eureka</artifactId>
<version>0.0.1</version>
<description>POM was created from install:install-file</description>
</project>
4.0.0
蒂亚戈·美第奇
尤里卡
0.0.1
POM是从install:install文件创建的
mvn install:install-file -Dfile=c:\tiago.medici-0.0.1.jar -DgroupId=tiago.medici -DartifactId=eureka -Dversion=0.0.1 -Dpackaging=jar
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>tiago.medici</groupId>
<artifactId>eureka</artifactId>
<version>0.0.1</version>
<description>POM was created from install:install-file</description>
</project>