简体   繁体   中英

Jenkins failed to build SpringBoot Project (could not find the class org.springframework.asm.ClassVisitor)

When i used Jenkins to build a springboot(1.4.0 version) project, a problem encoutered, which is about not being able to find the class org.springframework.asm.ClassVisitor. The building error is as follow:

Caused by: java.lang.NoClassDefFoundError: org/springframework/asm/ClassVisitor at org.springframework.boot.loader.tools.Repackager.findMainMethod(Repackager.java:310) at org.springframework.boot.maven.RepackageMojo$LoggingRepackager.findMainMethod(RepackageMojo.java:372) at org.springframework.boot.loader.tools.Repackager.buildManifest(Repackager.java:284) at org.springframework.boot.loader.tools.Repackager.repackage(Repackager.java:207) at org.springframework.boot.loader.tools.Repackager.repackage(Repackager.java:152) at org.springframework.boot.maven.RepackageMojo.repackage(RepackageMojo.java:206) at org.springframework.boot.maven.RepackageMojo.execute(RepackageMojo.java:193) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ... 32 more Caused by: java.lang.ClassNotFoundException: org.springframework.asm.ClassVisitor at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.pl exus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)

However, the class org.springframework.asm.ClassVisitor existed in the spring-core-4.3.2.RELEASE.jar. It seemed tha maven was unable to locate the required class when building the project. Additionally, i have to make it clear that i didn't include spring-asm-xxx.jar in my springboot project, so there was no chance of existing a jar conflict. And, what is very strange to me is, that i built the same springboot project successfully in IDEA.

I've no idea why this would happen. What possible reasons do you think are to cause this problem? Looking forward to your reply! Thanks in advance!

Thanks for your comments. Luckily I've solved the problem by integrating two local maven repositories. Previously, about a month ago, I once built successfully a springboot project in Jenkins. And for last springboot project which I failed to build in Jenkins, I used another local maven repository, which encountered the problem that I mentioned above. Today I tried integrating the two maven repositories to if it would work, and very luckily it worked and the springboot project was built successfully. In spite of that, I'm still confused about what went wrong with the problematic repository.

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