Closed uehlbran closed 5 years ago
Let's talk about this project. It doesn't work: (at least not like it could or should)
[INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] sfg-pet-clinic [pom] [INFO] pet-clinic-data [jar] [INFO] pet-clinic-web [jar] [INFO] [INFO] ----------------< guru.springframework:sfg-pet-clinic >----------------- [INFO] Building sfg-pet-clinic 0.0.5-SNAPSHOT [1/3] [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] >>> spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) > test-compile @ sfg-pet-clinic >>> [INFO] [INFO] <<< spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) < test-compile @ sfg-pet-clinic <<< [INFO] [INFO] [INFO] --- spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) @ sfg-pet-clinic --- [WARNING] java.lang.ClassNotFoundException: guru.springframework.sfgpetclinic.SfgPetClinicApplication at java.net.URLClassLoader.findClass (URLClassLoader.java:381) at java.lang.ClassLoader.loadClass (ClassLoader.java:424) at java.lang.ClassLoader.loadClass (ClassLoader.java:357) at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run (AbstractRunMojo.java:491) at java.lang.Thread.run (Thread.java:748) [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] sfg-pet-clinic 0.0.5-SNAPSHOT ...................... FAILURE [ 0.554 s] [INFO] pet-clinic-data .................................... SKIPPED [INFO] pet-clinic-web 0.0.5-SNAPSHOT ...................... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.941 s [INFO] Finished at: 2019-09-02T16:30:19-06:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) on project sfg-pet-clinic: An exception occurred while running. guru.springframework.sfgpetclinic.SfgPetClinicApplication -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [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
Adding this to the parent pom does not fix it:
However, here is how you fix it:
Go to your parent POM file and change this section of code to this:
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin>
Then go to your pet-clinic-web POM file and add this section:
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <skip>false</skip> </configuration> </plugin> </plugins> </build>
Now you can run the mvn spring-boot:run command from anywhere inside of the project.
Let's talk about this project. It doesn't work: (at least not like it could or should)
[INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] sfg-pet-clinic [pom] [INFO] pet-clinic-data [jar] [INFO] pet-clinic-web [jar] [INFO] [INFO] ----------------< guru.springframework:sfg-pet-clinic >----------------- [INFO] Building sfg-pet-clinic 0.0.5-SNAPSHOT [1/3] [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] >>> spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) > test-compile @ sfg-pet-clinic >>> [INFO] [INFO] <<< spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) < test-compile @ sfg-pet-clinic <<< [INFO] [INFO] [INFO] --- spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) @ sfg-pet-clinic --- [WARNING] java.lang.ClassNotFoundException: guru.springframework.sfgpetclinic.SfgPetClinicApplication at java.net.URLClassLoader.findClass (URLClassLoader.java:381) at java.lang.ClassLoader.loadClass (ClassLoader.java:424) at java.lang.ClassLoader.loadClass (ClassLoader.java:357) at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run (AbstractRunMojo.java:491) at java.lang.Thread.run (Thread.java:748) [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] sfg-pet-clinic 0.0.5-SNAPSHOT ...................... FAILURE [ 0.554 s] [INFO] pet-clinic-data .................................... SKIPPED [INFO] pet-clinic-web 0.0.5-SNAPSHOT ...................... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.941 s [INFO] Finished at: 2019-09-02T16:30:19-06:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) on project sfg-pet-clinic: An exception occurred while running. guru.springframework.sfgpetclinic.SfgPetClinicApplication -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [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
Adding this to the parent pom does not fix it:
However, here is how you fix it:
Go to your parent POM file and change this section of code to this:
Then go to your pet-clinic-web POM file and add this section:
Now you can run the mvn spring-boot:run command from anywhere inside of the project.