Sean
Sean

Reputation: 56

Jenkins compiling wrong code for the right version

Here's the rundown of what's confusing me:

Built original code in NetBeans 8.0, using Maven. Builds successfully with all modules. Commit current source to gitlab and double-check that the commit is complete.

Point Jenkins to the same revision (on gitlab) as the successfully building code.

Build fails, due to attempting to import a package that does not exist (makes sense that this would fail), that the revision of code that is building never actually calls for (does not make sense).


From the code in gitlab:

import com.company.path.toPackage.currentToken.packageName;
(other imports on same package path)


On Jenkins (linebreaks in error mine, for readability):

[ERROR] /var/lib/jenkins/jobs/Project Name - 
branch/workspace/module/src/main/java/com/
company/path/toPackage/oldToken/packageName/PackageMember:[3,57] 
package com.company.path.toPackage.oldToken.packageName does not exist

(same error for every import on same package path)


It looks like it might be a pom issue, so I pull up the pom (also from the revision that Jenkins claims to be looking at):

<parent>
        <artifactId>project</artifactId>
        <groupId>com.company.path.toPackage.currentToken</groupId>
        <version>versionInfo</version>
        <relativePath>../parent-project</relativePath>
    </parent>
    <dependencies>

        <!-- project dependencies: platform -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>packageName</artifactId>
            <version>${project.version}</version>

...
The master pom declares the groupID correctly:

<groupId>com.company.path.toPackage.currentToken</groupId>


I'm currently at a loss as to why Jenkins is not compiling the code that the revision it is pointed at actually contains. I have confirmed that the revision number under Git Build Data matches the revision number for the head of the branch on gitlab, and that this is the same revision number as what I can successfully build using Maven in my IDE. Could someone point me in the right direction for troubleshooting this?

[EDIT] Other modules with similar dependencies in the same project built without complaint, and I am comparing pom files and package structure.

Thank you in advance.

Upvotes: 0

Views: 555

Answers (1)

Sean
Sean

Reputation: 56

As mentioned in comments above, solution involved going through gitlab (in browser) and discovering files/folders that were on the repository under the expected version that were not being pulled through SourceTree (and thus never showing up on local builds).
From there, checking out the repository and removing the offending files/folders and checking back in the modified repository cleared up the import conflict. It could easily just be my not having SourceTree configured correctly to do what I expected it to. It also might be connected to some of the syncing-related bugs reported on SourceTree's Jira.

Upvotes: 0

Related Questions