Maven 2 Maven:pom.xml,无法解析包

Maven 2 Maven:pom.xml,无法解析包,maven-2,jenkins,pom.xml,Maven 2,Jenkins,Pom.xml,我试图在Jenkins持续集成中使用maven构建项目,为此我编写了pom.xml,包括所有必需的jar文件,我的pom如下 <modelVersion>4.0.0</modelVersion> <repositories> <repository> <id>central</id> <name>My Company's Internal Repository</name

我试图在Jenkins持续集成中使用maven构建项目,为此我编写了pom.xml,包括所有必需的jar文件,我的pom如下

<modelVersion>4.0.0</modelVersion>
  <repositories>
    <repository>
      <id>central</id>
      <name>My Company's Internal Repository</name>
      <layout>default</layout>
      <url>file:///D:/MavenRepos/</url>
    </repository>
  </repositories>



 <groupId>codon</groupId>
  <artifactId>Struts2OfficeExpenses</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Struts2Office Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>  
   <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.13</version>
       <scope>main</scope>
    </dependency>
    <dependency>
    <groupId>ibatis</groupId>
    <artifactId>ibatis-common</artifactId>
    <version>2.0</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
       <groupId>org.apache.ibatis</groupId>
       <artifactId>ibatis-sqlmap</artifactId>
       <version>2.0</version>       
       <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>geronimo</groupId>
        <artifactId>geronimo-management</artifactId>  
        <version>1.0</version>

    </dependency>  
    <dependency>
       <groupId>javax.servlet.jsp</groupId>
         <artifactId>jsp-api</artifactId>
         <version>2.1</version>
         <scope>main</scope>
        </dependency>    
    <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts2-core</artifactId>
      <version>2.1.8</version>
      <scope>main</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>Struts2OfficeExpenses</finalName>
  </build>
</project>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>codon</groupId>
  <artifactId>Struts2OfficeExpenses</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Struts2Office Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
   <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.13</version>
       <scope>test</scope>
    </dependency>
   <dependency>
      <groupId>ibatis</groupId>
       <artifactId>ibatis-common</artifactId>
       <version>2.0</version>
       <scope>system</scope>
      <systemPath>D:\MavenRepos\ibatis\ibatis-common\2.0\ibatis-common-2.0.jar</systemPath>
  </dependency>
    <dependency>
      <groupId>org.apache.ibatis</groupId>
       <artifactId>ibatis-sqlmap</artifactId>
       <version>2.0</version>       
       <scope>system</scope>
       <systemPath>D:\MavenRepos\org\apache\ibatis\ibatis-sqlmap\2.0\ibatis-sqlmap-2.0.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>geronimo</groupId>
        <artifactId>geronimo-management</artifactId>
        <version>1.0</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.4</version>
        <scope>provided</scope>
    </dependency>    
    <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts2-core</artifactId>
      <version>2.1.8</version>
       <scope>system</scope>
      <systemPath>D:\MavenRepos\repository\org\apache\struts\struts2-core\2.1.8\struts.jar</systemPath>
    </dependency>
  </dependencies>
  <build>
    <finalName>jk-ex-3-POM</finalName>
  </build>
</project>
" 请引导我..
在此处输入代码

我试图在Jenkins持续集成中使用maven构建项目

一步一个脚印。首先尝试让maven在本地工作,然后在Jenkins内部尝试同样的方法

如果您对依赖项有问题,
mvn-dependency:list
mvn-dependency:tree
会非常有用。在这里考虑依赖关系的范围是很重要的

我在pom.xml中看到一个奇怪的
main/
,这可能就是问题所在。
有关作用域的一些文档,请参阅。

我可以通过如下修改pom来解决此问题

<modelVersion>4.0.0</modelVersion>
  <repositories>
    <repository>
      <id>central</id>
      <name>My Company's Internal Repository</name>
      <layout>default</layout>
      <url>file:///D:/MavenRepos/</url>
    </repository>
  </repositories>



 <groupId>codon</groupId>
  <artifactId>Struts2OfficeExpenses</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Struts2Office Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>  
   <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.13</version>
       <scope>main</scope>
    </dependency>
    <dependency>
    <groupId>ibatis</groupId>
    <artifactId>ibatis-common</artifactId>
    <version>2.0</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
       <groupId>org.apache.ibatis</groupId>
       <artifactId>ibatis-sqlmap</artifactId>
       <version>2.0</version>       
       <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>geronimo</groupId>
        <artifactId>geronimo-management</artifactId>  
        <version>1.0</version>

    </dependency>  
    <dependency>
       <groupId>javax.servlet.jsp</groupId>
         <artifactId>jsp-api</artifactId>
         <version>2.1</version>
         <scope>main</scope>
        </dependency>    
    <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts2-core</artifactId>
      <version>2.1.8</version>
      <scope>main</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>Struts2OfficeExpenses</finalName>
  </build>
</project>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>codon</groupId>
  <artifactId>Struts2OfficeExpenses</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Struts2Office Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
   <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.13</version>
       <scope>test</scope>
    </dependency>
   <dependency>
      <groupId>ibatis</groupId>
       <artifactId>ibatis-common</artifactId>
       <version>2.0</version>
       <scope>system</scope>
      <systemPath>D:\MavenRepos\ibatis\ibatis-common\2.0\ibatis-common-2.0.jar</systemPath>
  </dependency>
    <dependency>
      <groupId>org.apache.ibatis</groupId>
       <artifactId>ibatis-sqlmap</artifactId>
       <version>2.0</version>       
       <scope>system</scope>
       <systemPath>D:\MavenRepos\org\apache\ibatis\ibatis-sqlmap\2.0\ibatis-sqlmap-2.0.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>geronimo</groupId>
        <artifactId>geronimo-management</artifactId>
        <version>1.0</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.4</version>
        <scope>provided</scope>
    </dependency>    
    <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts2-core</artifactId>
      <version>2.1.8</version>
       <scope>system</scope>
      <systemPath>D:\MavenRepos\repository\org\apache\struts\struts2-core\2.1.8\struts.jar</systemPath>
    </dependency>
  </dependencies>
  <build>
    <finalName>jk-ex-3-POM</finalName>
  </build>
</project>

4.0.0
密码子
Struts2办公费用
战争
1.0-快照
Struts2OfficeMaven网络应用程序
http://maven.apache.org
朱尼特
朱尼特
3.8.1
测试
log4j
log4j
1.2.13
测试
伊巴蒂斯
普通食道炎
2
系统
D:\MavenRepos\ibatis\ibatis common\2.0\ibatis-common-2.0.jar
org.apache.ibatis
iBATISsqlmap
2
系统
D:\MavenRepos\org\apache\ibatis\ibatis sqlmap\2.0\ibatis-sqlmap-2.0.jar
geronimo
geronimo管理
1
编译
javax.servlet
servlet api
2.4
假如
org.apache.struts
struts2型芯
2.1.8
系统
D:\MavenRepos\repository\org\apache\struts\struts2 core\2.1.8\struts.jar
jk-ex-3-POM

感谢您的回复,在我将作用域更改为compile并尝试在本地maven中运行之后,即使在那里,我也会遇到相同的错误。尽管它可以工作,但它决不是正确的解决方案,因为依赖项的路径是
硬编码的
。虽然您在问题中指定了编译错误,但在下载相关依赖项之前可能存在错误。因此,您能否指导我如何在不使用硬编码的情况下获得正确的解决方案,更新pom以使用工件的
编译
范围并再次运行maven。通过发布您看到的任何错误来编辑您的问题(在编译之前)。