나는 멀티 모듈 받는다는 스프링 booot 받는다는 프로젝트가 있습니다. 아이 모듈 중 하나는 내가 시작하고 중지 할 것인지 그루터기 (스프링 부팅 응용 프로그램)이다 의 통합 테스트 중에 myRealApp .
Parent Pom
|
|----myRealApp module(spring boot app)
|----stub-of-some-remote-rest-api module(This is also a spring-boot app)
POM을 파일 외모 모듈 myRealApp에 좋아하는 방법이다. 어떤 또한 모든 통합 테스트가 있습니다. 그 전에 통합 - 테스트 단계에서 스텁 모듈을 시작하려고합니다. 나는 아이 모듈 디렉토리에 받는다는 목표를 실행할 때 나는 오류가 발생합니다 :
mvn integration-tests -X
오류 : 주 클래스 io.swagger.MyStub를 찾거나로드 할 수 없습니다
org.apache.maven.lifecycle.LifecycleExecutionException은 : 프로젝트 실행 (시작 - 부팅) : 스프링 부팅 받는다는 - 플러그인 : 목표 org.springframework.boot을 실행하지 못했습니다 1.5.8.RELEASE 수 없습니다 간부 자바
나는 작업 디렉토리가 올바르게 설정되어 있는지 있음을 디버그 모드에서 볼 수 있습니다.
myRealApp의 폼은 :
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>${spring.boot.mainclass}</mainClass>
</configuration>
<executions>
<execution>
<configuration>
<workingDirectory>${project.parent.basedir}/module-of-my-stub/src/main/java</workingDirectory>
<mainClass>io.swagger.MyStub</mainClass>
</configuration>
<id>start-boot</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>stop-boot</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
아마는 다른 모듈에 개별 실행에 설정 WORKINGDIRECTORY, 또는주고 참조에 허용되지 않는 건가요?
스텁은 실제 원격 서비스의 테스트 환경은 신뢰할 수 없습니다이고 시간의 절반 아래로 때부터 개발하는 동안 사용 내 응용 프로그램에 따라하는 원격 나머지 서비스처럼 행동이있다. 그래서 통합도 테스트도 그것을 사용하기로 결정했다.
질문에 대한 의견의 일부를 통합하려면 다음은 기본적으로 조언을 따라 이 다른 대답을 .
키는 설정 한 classesDirectory
에 대해 spring-boot-maven-plugin:run
받는 점에 목표를 target\classes
다른 프로젝트에서 디렉토리.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>${spring.boot.mainclass}</mainClass>
</configuration>
<executions>
<execution>
<id>start-stub</id>
<configuration>
<arguments>
<argument>--server.port=8090</argument>
</arguments>
<mainClass>io.swagger.Stub</mainClass>
<classesDirectory>../my-stub/target/classes</classesDirectory>
</configuration>
<goals>
<goal>start</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>