Basic jdk8 build failing circleci.com, working locally

Resolved!!!

Running this build locally, both directly from a docker build container AND executing ‘circleci build’ from command line are Successful.

I’ve attempted this with using two different docker containers for the build.
verilumaci/maven-3.3.9

Maven 3.3.9
Java - jdk8

However when running on CircleCI.com. It fails in the same place every time.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile (default-compile) on project
AttachedDocument.java:[3,39] cannot find symbol

To add more light to this. I’m running this build inside a docker container.

version: 2
jobs:
  build:
    docker:
      - image: verilumaci/maven-3.3.9
    auth:
      username: $DOCKERHUB_USER_NAME
      password: $DOCKERHUB_PASSWORD
    steps:
      - checkout
      - run:
          name: mvn build
          command: |
            pwd
            ls -la
            mvn -v
            cd nrms-parent
            mvn clean install

nrms-parent is the directory where the pox.xml is.

Dockerfile:

  FROM andreptb/oracle-java:8
  RUN apk add --no-cache curl tar bash procps
  ARG MAVEN_VERSION=3.3.9
  ARG USER_HOME_DIR="/root"
  ARG SHA=6e3e9c949ab4695a204f74038717aa7b2689b1be94875899ac1b3fe42800ff82
  ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries

  RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
  && curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}- 
  bin.tar.gz \
  && echo "${SHA}  /tmp/apache-maven.tar.gz" | sha256sum -c - \
  && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
  && rm -f /tmp/apache-maven.tar.gz \
  && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
  ENV MAVEN_HOME /usr/share/maven
  ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

  COPY mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh
  COPY settings-docker.xml /usr/share/maven/ref/

  ENTRYPOINT ["/usr/local/bin/mvn-entrypoint.sh"]
  CMD ["mvn clean install"]

What is in AttachedDocument.java that it appears to be getting stuck on?

Just a java class. Works fine when I run circleci locally.

Lovely. May we see it, or the relevant part of it?

What exactly are you looking for? This is for a client so I can’t really copy the code.

It’s not necessarily for me - I don’t do Java. Readers are, in my view, most unlikely to be able to help here as it stands, since the question is brief and lacking in the kinds of details readers would usually reach for if the problem was in a console in front of them.

Unless you are under a particularly strong NDA, I suggest you just show the code - it appears to be choking on that file, and thus that is what people would want to look at. Remove client-identifying material if required, of course. (Aside: most small pieces of code are not worth protecting from an IP perspective, since any competent engineer can reproduce that code from first principles).

(Note that this is not a busy forum, so anything you can do to help folks help you is a good thing!)

Yes I understand. I don’t think this is a code issue however because it works just fine building both locally and using circleci cli.

Sure, it could be an environmental issue, but what that issue is may be revealed by looking at the code. For example, perhaps there is a new Java version/syntax, which is present in your local system, and not on the remote. Or perhaps there is a different version of Maven.

I understand. thanks for the help. I’m not making this easy by not providing the code or additional details.

Feedback: ideally, questions written on a help forum are preserved in their original state so they can also help new readers. Rather than asking a new question, a new reader can use the search function, and find old relevant problems.

Thus, editing an original post to say “resolved” in the first line is confusing, since the new reader then has to wade through the edit history to work out what the original looked like. It turns out that’s the only edit on this post, but it’s not clear from looking at the modified version - any amount of the post could be part of the edit.

The best approach is to add a new answer. In Discourse, which is the forum software we’re using, this has the advantage that interested subscribers are notified of the change, and importantly, you can then use the feature for explicitly marking a post as the solution. Self-answers are extremely welcome.

(This is useful feedback for future questions, but ideally, please also roll back the first post one edit, and make that new post. You never know, it may help someone. Consider it the “price” of asking for assistance :smiley_cat: ).

1 Like

Have you tried rerunning the workflow with SSH and actually looked at what code AttachedDocument.java contains?

I have a similar problem in a node build for a client, and in circleci the file content is actually changed, and that’s why the build fails. Does not happen locally.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.