spring-guides / gs-spring-boot

Building an Application with Spring Boot :: Learn how to build an application with minimal configuration.
https://spring.io/guides/gs/spring-boot/
Apache License 2.0
890 stars 4.51k forks source link

failed to execute jar generated with Maven 2.x #6

Closed dprotti closed 10 years ago

dprotti commented 10 years ago

If app is generated in Linux with Maven 2.2.1 then it fails on execution. That's because generated jar does not have a /lib folder with app's dependencies.

$ mvn -version Apache Maven 2.2.1 (r801777; 2009-08-06 14:16:01-0500) Java version: 1.7.0_25 $ mvn package && java -jar target/gs-spring-boot-0.1.0.jar Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2521) at java.lang.Class.getDeclaredMethod(Class.java:1992) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) at java.lang.Thread.run(Thread.java:724) Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ... more traces

I suggest to explicitly request Maven 3.x in the Readme and guides.

gregturn commented 10 years ago

Under "what you'll need" it says maven 3.0+.

dprotti commented 10 years ago

You are right.

However, the corresponding section is not being included in generated README's. I tried with both asciidoc and asciidoctor tools, and none of them include prereq_editor_jdk_buildtools.adoc file content correctly. Even when I didn't run neither of asciidoc nor asciidoctor in safe mode.

How do you process README.adoc to generate a complete README file?

gregturn commented 10 years ago

Read https://github.com/spring-guides/draft-gs-template/wiki/Working-with-AsciiDoctor.

dprotti commented 10 years ago

The link above is broken (404). Anyway the generated guide it's OK and mentions Maven 3 as a prereq. I was just wondering how to generate it from the .adoc. Thanks.

gregturn commented 10 years ago

That repo is private.