我想从测试包中添加一个java类到exec-maven-plugin
执行。
正如你可以看到我试过的那样:
<classpathScope>test</classpathScope>
找不到我的测试资源。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>generateIgniteSchemaClasses</id>
<phase>process-test-resources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<executableDependency>
<groupId>com.package</groupId>
<artifactId>ignite-schema-import</artifactId>
</executableDependency>
<mainClass>com.package.SchemaImportApplication</mainClass>
<arguments>
<argument>${project.build.testOutputDirectory}/xml/schema.xml</argument>
</arguments>
<classpathScope>test</classpathScope>
</configuration>
</execution>
</executions>
</plugin>
并且为了执行传递,我需要一个来自test com.package
测试资源是测试注释类型接口,在类的执行中是必需的。
答案 0 :(得分:0)
在对解决方案中的更多内容进行调查之后,我得出的结论是,在项目中创建一个新的测试模块会更好
<build>
<plugins>
<!-- This is a test module, so it does not need to be deployed -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
我在上面的模块中添加了测试资源:
<dependency>
<groupId>com.project</groupId>
<artifactId>project-test-module</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>