Open kumarineha304 opened 7 months ago
The exception is thrown here.
I guess your project is not a war
project, right? Then what the code does is simple: retrieving project build output (e.g., compiled .class
files, dependency .jar
s, resource files, etc.), and normally, it won't throw an IOException
(except for the obvious case where /codebuild/output/src3077/src/DemoService/demo-service/target/classes
doesn't exist, which means you didn't compile your project or somehow Jib ran before Maven had a chance to create the directory).
But looking at this part,
instead of "mvn clean compile jib:build"?): /codebuild/output/src3077/src/DemoService/demo-service/target/classes -> [Help 1]
the message is the underlying exception from here, so it definitely means there was an I/O error when dealing with this particular directory (/codebuild/output/src3077/src/DemoService/demo-service/target/classes
).
BTW, you can make Maven output debug logs and get the full stack trace with mvn -X ...
, although I think the exception message you will get would be the same.
Thank you for taking time to respond to the query, the problem with the issue is its not consistent things are working perfectly fine now so I won't be able to regenerate it somehow all of a sudden I start getting this error and it keeps on going for a while and it again gets resolved all on its own.
We are using 3.3.1 of the jib plugin can this be resolved using the higher version. Or we need to change something the way we are building our project.
Yes you said it right we don't have the application getting build as a war.
I don't think upgrading Jib will fix it. It's an error in your system where Jib is unable to read /codebuild/output/src3077/src/DemoService/demo-service/target/classes
because a normal I/O operation fails. One common cause is that the user didn't run mvn compile
, which would create the output directory. But I am not sure if that's the case here. Your filesystem might genuinely have IO issues.
Some possibilities I can think of:
/codebuild/output/src3077/src
is a network file system and you sometimes have issues accessing them./codebuild/output/src3077/src/DemoService/demo-service/target/classes
is created.As a desperate move, you could try mvn compile && sleep 5s && ls <project root>/demo-service/target/classes && sleep 5s && ls <project root>/demo-service/target/classes && mvn jib:build
or something like that.
I have below jib-maven-plugin dependency added in my maven pom.xml file as below:
Usually my build runs completely fine and all images are built as expected but there are intermittent failure issues where the build starts failing and fails continuously for 2-3 days sometimes a week and then gets fixed on its own all of a sudden.
I get below error when the build fails: Error: -04 12:46:45.430000: [ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.3.1:dockerBuild (default-cli) on project demo-service: Obtaining project build output files failed; make sure you have compiled your project before trying to build the image. (Did you accidentally run "mvn clean jib:build" instead of "mvn clean compile jib:build"?): /codebuild/output/src3077/src/DemoService/demo-service/target/classes -> [Help 1] Error: -04 12:46:45.430000: [ERROR]