简体   繁体   中英

Java+Maven builds on Jenkins but not on local machine

I have a strange problem. My build is working on Jenkins but not locally. It used to work locally but stopped for some reason.

I have no uncommitted changes. The code on Jenkins is in sync with my master branch(using Git).

I have deleted all uncommitted files from my local machines project.

Mvn -version on local machine:

Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T09:58:13+02:00)
Maven home: /Users/andersvincentlund/Downloads/apache-maven-3.5.2
Java version: 9.0.4, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
Default locale: en_SE, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"

Tool configuration on Jenkins machine:

jdk-9.0.1
apache-maven-3.5.2

Compiler plugin in Maven in the code:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
    </plugin>

Build result on Jenkins:

[INFO] Reactor Summary:
[INFO] 
[INFO] RootProject ..................................... SUCCESS [  1.781 s]
[INFO] ProjectA ........................................ SUCCESS [ 15.344 s]
[INFO] ProjectB ............................................ SUCCESS [ 35.063 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

Build result from local machine:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] RootProject ..................................... SUCCESS [  0.350 s]
[INFO] ProjectA ........................................ SUCCESS [  1.285 s]
[INFO] ProjectB ............................................ FAILURE [  1.402 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

Failures in ProjectB are referencing packages in Project A. All look like this:

[ERROR] /somePath1/src/main/java/somePath2/SomeFile.java:[10,38] error: package some.package.in.projectA does not exist

I know my Maven and Java aren't exactly the same version on the different machines. The local one is a Mac running Sierra. The remote one is Windows Server 2012 R2. Since I am using the maven compile plugin to set the version to Java 7 it shouldn't be a problem right? I don't get this. Normally the issue is that it is working locally but not on Jenkins. This is the other way around. Help would be greatly appreciated. Starting to feel really stupid over here.

EDIT: Tried on another Mac. Same result as with my Mac, failure. Created a VM with Windows and tried again, same result as with the server. Success. Seems to be a problem isolated to Mac. It has worked on Mac before so I am considering if an update has broken something.

I a compile action works on Windows but not on OSX/Linux the most common failure is a file with wrong uppercase or lowercase character in the file name (or directory name).

As Windows works case insensitive it is able to find and access the file.

OSX and Linux are working case sensitive and therefore are not able to acces the file.

Check the directory names of the package some.package.in.projectA and the filename of the Java files that they exactly match the package respectively class name(s).

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