Przeszukałem forum, aby znaleźć odpowiedź na mój problem, ale nie mogłem go znaleźć. Mój problem polega na tym, że:Jak zmusić maven do pobierania zasobów z/src/test/resources zamiast/src/main/resources dla projektu zależnego?
Mam dwa projekty: ProjectA i ProjectB. ProjectB używa ProjectA. W ProjectA mam dwa foldery: /src/main/resources i/src/test/resources. W ProjectB i uruchom: mvn clean install. Chcę, aby w fazie testowej klasy w ProjectB korzystały z zasobów z/src/test/resources zamiast/src/main/resources.
To co próbowałem: http://www.waltercedric.com/java-j2ee-mainmenu-53/361-maven-build-system/1349-maven-reusing-test-classes-across-multi-modules-projects.html
Jest podobny do mojego problemu, ale po skonfigurowaniu bramki test-jar dla Projecta, ProjectB nadal prowadzi badania w sposób, że zajęcia z właściwościami ruchu Projecta z/src/main/resources zamiast/src/test/resources.
Moje pom.xml w Projecta wygląda następująco:
<project ...>
<parent>
...
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ProjectA</artifactId>
<packaging>jar</packaging>
<dependencies>
...
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
W ProjectB moim pom.xml wygląda następująco:
<project ...>
<parent>
...
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ProjectB</artifactId>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sensano</groupId>
<artifactId>ProjectA</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ProjectA</groupId>
<artifactId>ProjectA</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>
</dependencies>
</project>
Czy istnieje metoda Każda pomoc będzie mile widziana!
poważaniem
Mateusz Moroz