question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build image failed, perhaps you should run 'mvn clean' to clear your build cache

See original GitHub issue

Description of the issue: when i to try build maven project use jenkins , The Jib throw this exception. It was normal before today.

Expected behavior:

Steps to reproduce:

Environment:

jib-maven-plugin Configuration:

<build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.google.cloud.tools</groupId>
                    <artifactId>jib-maven-plugin</artifactId>
                    <version>0.9.8</version>
                    <configuration>
                        <from>
                            <image>frolvlad/alpine-oraclejdk8</image>
                        </from>
                        <to>
                            <image>172.21.16.8:5000/${project.name}:${project.version}</image>
                        </to>
                        <container>
                            <jvmFlags>
                                <jvmFlag>-Xms128m</jvmFlag>
                                <jvmFlag>-Xmx128m</jvmFlag>
                                <jvmFlag>-Duser.timezone=GMT+08</jvmFlag>
                            </jvmFlags>
                            <mainClass>cn.com.sharebang.MainApplication</mainClass>
                            <ports>
                                <port>${project.port}</port>
                            </ports>
                            <format>Docker</format>
                        </container>
                        <allowInsecureRegistries>true</allowInsecureRegistries>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>build</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

Log output:

Commit message: “Merge remote-tracking branch ‘origin/dev’ into dev”

/usr/bin/git rev-list --no-walk fc5979095c2b786b5181cbfeece0636f8f4a0ff8 # timeout=10 [dev-account] $ /var/local/apache-maven-3.5.2/bin/mvn clean package -pl account -am -X -Dmaven.test.skip=true -Pdev Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T15:58:13+08:00) Maven home: /var/local/apache-maven-3.5.2 Java version: 1.8.0_161, vendor: Oracle Corporation Java home: /var/local/jdk1.8.0_161/jre Default locale: en_US, platform encoding: UTF-8 OS name: “linux”, version: “3.10.0-693.el7.x86_64”, arch: “amd64”, family: “unix” … … [DEBUG] /var/local/data/maven_repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar [DEBUG] /var/local/data/maven_repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar [DEBUG] /var/local/data/maven_repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar [DEBUG] /var/local/jdk1.8.0_161/jre/…/lib/jconsole.jar [DEBUG] /var/local/jdk1.8.0_161/jre/…/lib/tools.jar [INFO] [DEBUG] TIMING Building and pushing image [DEBUG] RUNNING Building and pushing image [DEBUG] TIMED Building and pushing image : 1103.041 ms [DEBUG] Building and pushing image : 1103.041 ms [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] sharebang-service … SUCCESS [ 1.419 s] [INFO] account … FAILURE [ 10.590 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 14.482 s [INFO] Finished at: 2018-08-16T17:54:00+08:00 [INFO] Final Memory: 88M/805M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.9.6:build (default) on project account: Build image failed, perhaps you should run ‘mvn clean’ to clear your build cache: com.fasterxml.jackson.databind.JsonMappingException: Unexpected end-of-input within/between Array entries [ERROR] at [Source: (sun.nio.ch.ChannelInputStream); line: 1, column: 184641] [ERROR] at [Source: (sun.nio.ch.ChannelInputStream); line: 1, column: 184319] (through reference chain: com.google.cloud.tools.jib.cache.json.CacheMetadataTemplate[“layers”]) [ERROR] -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.9.6:build (default) on project account: Build image failed, perhaps you should run ‘mvn clean’ to clear your build cache at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: Build image failed, perhaps you should run ‘mvn clean’ to clear your build cache at com.google.cloud.tools.jib.maven.BuildImageMojo.execute (BuildImageMojo.java:150) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: com.google.cloud.tools.jib.cache.CacheMetadataCorruptedException: com.fasterxml.jackson.databind.JsonMappingException: Unexpected end-of-input within/between Array entries at [Source: (sun.nio.ch.ChannelInputStream); line: 1, column: 184641] at [Source: (sun.nio.ch.ChannelInputStream); line: 1, column: 184319] (through reference chain: com.google.cloud.tools.jib.cache.json.CacheMetadataTemplate[“layers”]) at com.google.cloud.tools.jib.cache.Cache.loadCacheMetadata (Cache.java:68) at com.google.cloud.tools.jib.cache.Cache.init (Cache.java:48) at com.google.cloud.tools.jib.cache.Caches.<init> (Caches.java:122) at com.google.cloud.tools.jib.cache.Caches.<init> (Caches.java:31) at com.google.cloud.tools.jib.cache.Caches$Initializer.init (Caches.java:106) at com.google.cloud.tools.jib.builder.BuildSteps.run (BuildSteps.java:187) at com.google.cloud.tools.jib.frontend.BuildStepsRunner.build (BuildStepsRunner.java:187) at com.google.cloud.tools.jib.maven.BuildImageMojo.execute (BuildImageMojo.java:146) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: com.fasterxml.jackson.databind.JsonMappingException: Unexpected end-of-input within/between Array entries at [Source: (sun.nio.ch.ChannelInputStream); line: 1, column: 184641] at [Source: (sun.nio.ch.ChannelInputStream); line: 1, column: 184319] (through reference chain: com.google.cloud.tools.jib.cache.json.CacheMetadataTemplate[“layers”]) at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath (JsonMappingException.java:391) at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath (JsonMappingException.java:351) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow (BeanDeserializerBase.java:1711) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize (BeanDeserializer.java:290) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize (BeanDeserializer.java:151) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose (ObjectMapper.java:4013) at com.fasterxml.jackson.databind.ObjectMapper.readValue (ObjectMapper.java:3070) at com.google.cloud.tools.jib.json.JsonTemplateMapper.readJsonFromFile (JsonTemplateMapper.java:63) at com.google.cloud.tools.jib.cache.Cache.loadCacheMetadata (Cache.java:63) at com.google.cloud.tools.jib.cache.Cache.init (Cache.java:48) at com.google.cloud.tools.jib.cache.Caches.<init> (Caches.java:122) at com.google.cloud.tools.jib.cache.Caches.<init> (Caches.java:31) at com.google.cloud.tools.jib.cache.Caches$Initializer.init (Caches.java:106) at com.google.cloud.tools.jib.builder.BuildSteps.run (BuildSteps.java:187) at com.google.cloud.tools.jib.frontend.BuildStepsRunner.build (BuildStepsRunner.java:187) at com.google.cloud.tools.jib.maven.BuildImageMojo.execute (BuildImageMojo.java:146) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected end-of-input within/between Array entries at [Source: (sun.nio.ch.ChannelInputStream); line: 1, column: 184641] at com.fasterxml.jackson.core.JsonParser._constructError (JsonParser.java:1804) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._skipWS2 (UTF8StreamJsonParser.java:2918) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._skipWS (UTF8StreamJsonParser.java:2888) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken (UTF8StreamJsonParser.java:709) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize (CollectionDeserializer.java:277) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize (CollectionDeserializer.java:245) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize (CollectionDeserializer.java:27) at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet (FieldProperty.java:136) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize (BeanDeserializer.java:288) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize (BeanDeserializer.java:151) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose (ObjectMapper.java:4013) at com.fasterxml.jackson.databind.ObjectMapper.readValue (ObjectMapper.java:3070) at com.google.cloud.tools.jib.json.JsonTemplateMapper.readJsonFromFile (JsonTemplateMapper.java:63) at com.google.cloud.tools.jib.cache.Cache.loadCacheMetadata (Cache.java:63) at com.google.cloud.tools.jib.cache.Cache.init (Cache.java:48) at com.google.cloud.tools.jib.cache.Caches.<init> (Caches.java:122) at com.google.cloud.tools.jib.cache.Caches.<init> (Caches.java:31) at com.google.cloud.tools.jib.cache.Caches$Initializer.init (Caches.java:106) at com.google.cloud.tools.jib.builder.BuildSteps.run (BuildSteps.java:187) at com.google.cloud.tools.jib.frontend.BuildStepsRunner.build (BuildStepsRunner.java:187) at com.google.cloud.tools.jib.maven.BuildImageMojo.execute (BuildImageMojo.java:146) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) [ERROR] [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :account Build step ‘Invoke top-level Maven targets’ marked build as failure Finished: FAILURE

THANKS!!!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
briandealwiscommented, Aug 16, 2018

Jib maintains two layer caches, a shared cache for layers pulled from your base image, and a per-project cache for layers created and pushed. Given that this is from a Jenkins job where you’re first performing a mvn clean, it must be the shared cache that’s causing problems. My guess is that the ~/.cache/google-cloud-tools-java/jib/metadata-v2.json file has become corrupt. Do you have multiple build jobs running in parallel?

You should be able to run the following to remove the cache and be on your way:

rm -rf ~/.cache/google-cloud-tools-java/jib/

and be on your way.

0reactions
shijiaomingcommented, Aug 24, 2018

@briandealwis Thank you very mush ,I ran this command , it’s worked. lol. rm -rf ~/.cache/google-cloud-tools-java/jib/

@coollog This issue never happened when i upgrade to 0.9.9. But I think this is because I ran this command first. so. I will update to 0.9.10 after that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to execute goal org.apache.maven.plugins:maven ...
Solution 1: Sometimes the build fails because, the target folder cannot be deleted. (It might be open in the backend due to the...
Read more >
google/jib - Gitter
On every my project build I execute mvn clean deploy mvn phases and jib:build ... clean will delete Jib's cache for application layers...
Read more >
How to fix Maven build issue in Eclipse? Perform ... - Crunchify
Perform maven-clean-install to fix any Java Dependency Issue ... You should see BUILD SUCCESS message after successful run.
Read more >
Troubleshooting AWS CodeBuild
Error : "This build image requires selecting at least one runtime version. ... Issue: AWS CodeBuild runs your build commands as the root...
Read more >
maven - Official Image | Docker Hub
The $MAVEN_CONFIG dir (default to /root/.m2 ) could be configured as a volume so anything copied there in a Dockerfile at build time...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found