Я использую Maven для создания затененной банки, которая является загрузочной.т.е. он поставляется со всеми необходимыми зависимостями и должен быть выполнен с использованием
java -jargration-tests.jar
Но когда я выполняю этот код, он выдает следующееисключение
Exception in thread "main" java.lang.reflect.InvocationTargetException
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.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.IllegalStateException: java.lang.ClassNotFoundException: org.springframework.boot.logging.java.JavaLoggingSystem
at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:130)
at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:117)
at com.ciscospark.integration.JUnitTestRunner.main(JUnitTestRunner.java:41)
... 8 more
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.logging.java.JavaLoggingSystem
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:125)
... 10 more
Но странно то, что если я разархивирую интеграционные тесты. jar, то найду
извлеченный / BOOT-INF / libspring-boot-1.4.7.RELEASE.jar
, в котором я найду
. / org / springframework / boot / logging / java / JavaLoggingSystem.class
Что я делаю не так?
Моя конфигурация Maven
<build>
<finalName>integration-tests</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.integration.JUnitTestRunner</mainClass>
<finalName>integration-tests</finalName>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>
<testSourceDirectory>${project.build.sourceDirectory}</testSourceDirectory>
</configuration>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.6.2</version>
<configuration>
<container>
<containerId>tomcat7x</containerId>
</container>
<configuration>
<type>standalone</type>
<properties>
<cargo.servlet.port>${tomcat.server.port}</cargo.servlet.port>
<cargo.rmi.port>${tomcat.rmi.port}</cargo.rmi.port>
<cargo.tomcat.ajp.port>${tomcat.ajp.port}</cargo.tomcat.ajp.port>
</properties>
</configuration>
<deployables>
<deployable>
<groupId>com.me</groupId>
<artifactId>my-server</artifactId>
<type>war</type>
<properties>
<context>/</context>
</properties>
<pingUrlPath>/ping</pingUrlPath>
</deployable>
</deployables>
</configuration>
<executions>
<execution>
<id>start-server</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-server</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>