简体   繁体   中英

Jenkins is unable to built project using maven

I have Configured SVN-Jenkins-Maven-Tomcat for a project. 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. I have manually added dependency jars to local maven repository.

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

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?

<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?

First thing to is to add SLF4j in your project, to do that add 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). Binding for NOP , silently discarding all logging.

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

2). Binding for System.out

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

3). Binding for log4j version 1.2.x. Also need to place log4j.jar on your class path.

<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). Binding for commons logging over slf4j.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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