简体   繁体   English

Jenkins无法使用Maven构建项目

[英]Jenkins is unable to built project using maven

I have Configured SVN-Jenkins-Maven-Tomcat for a project. 我已经为项目配置了SVN-Jenkins-Maven-Tomcat。 Every thing is working fine with small projects. 小型项目一切正常。 But when I tried to build my actual project which contains lots of jars and packages.. it shows error.. xxx package not found. 但是,当我尝试构建包含许多jar和程序包的实际项目时,它显示错误。xxx程序包未找到。 I have manually added dependency jars to local maven repository. 我已经手动将依赖项jar添加到本地Maven存储库。

pom.xml: pom.xml:

<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/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>optaplanner</groupId>
      <artifactId>optaplanner</artifactId>
      <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>
          <dependencies>
         <dependency>
          <groupId>annotation.code</groupId>
          <artifactId>annotations</artifactId>
          <version>2.0.1</version>
        </dependency>

        <dependency>
          <groupId>antlr-runtime.code</groupId>
          <artifactId>antlr-runtime</artifactId>
          <version>3.5</version>
        </dependency>

        .....
        .....

      </dependencies>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
              <source>1.7</source>
              <target>1.7</target>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </project>

Error: 错误:

/C:/Users/ANIRBAND/.jenkins/jobs/Test/workspace/src/main/java/org/optaplanner/examples/common/swingui/SolutionPanel.java:[25,48] package org.optaplanner.core.api.domain.solution does not exist /C:/Users/ANIRBAND/.jenkins/jobs/Test/workspace/src/main/java/org/optaplanner/examples/common/swingui/SolutionPanel.java:[72,29] cannot find symbol /C:/Users/ANIRBAND/.jenkins/jobs/Test/workspace/src/main/java/org/optaplanner/examples/common/swingui/ConstraintMatchesDialog.java:[45,17] package org.slf4j does not exist /C:/Users/ANIRBAND/.jenkins/jobs/Test/workspace/src/main/java/org/optaplanner/examples/common/swingui/SolutionPanel.java:[25,48]包org.optaplanner.core.api .domain.solution不存在/C:/Users/ANIRBAND/.jenkins/jobs/Test/workspace/src/main/java/org/optaplanner/examples/common/swingui/SolutionPanel.java:[72,29]无法查找符号/C:/Users/ANIRBAND/.jenkins/jobs/Test/workspace/src/main/java/org/optaplanner/examples/common/swingui/ConstraintMatchesDialog.java:[45,17]包org.slf4j没有存在

Can you help me in resolving the same? 您能帮我解决吗?

Given the error message I'd think you didn't add slf4j as a dependency into your project maybe? 鉴于错误消息,我想您可能没有将slf4j作为依赖项添加到您的项目中?

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.12</version>
</dependency>

Could you please post full pom.xml and error messages? 您能否发布完整的pom.xml和错误消息?

First thing to is to add SLF4j in your project, to do that add SLF4j API : 第一件事是添加SLF4j在你的项目中,要做到这一点添加SLF4j API

<properties>
<slf4jVersion>1.7.12</slf4jVersion>
</properties>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4jVersion}</version>
</dependency>

Next choose a binding library; 接下来选择一个绑定库; from one of the following: 从以下之一:

1). 1)。 Binding for NOP , silently discarding all logging. 绑定为NOP ,静默丢弃所有日志记录。

 <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-nop</artifactId>
    <version>${slf4jVersion}</version>
 </dependency>

2). 2)。 Binding for System.out 绑定System.out

<dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>slf4j-simple</artifactId>
   <version>${slf4jVersion}</version>
</dependency>

3). 3)。 Binding for log4j version 1.2.x. 绑定到log4j版本1.2.x。 Also need to place log4j.jar on your class path. 还需要将log4j.jar放在您的类路径上。

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>${slf4jVersion}</version>
</dependency>
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.16</version>
    <scope>runtime</scope>
</dependency>

4). 4)。 Binding for commons logging over slf4j. 通过slf4j绑定公用记录

<dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>jcl-over-slf4j</artifactId>
   <version>${slf4jVersion}</version>
   <scope>runtime</scope>
</dependency>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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