我想使用一些外部jar依赖项来编译测试文件,这些依赖项不会出现在pom.xml的依赖项标记中.有没有办法通过配置.像这样的东西 – plugin artifactIdmaven-compiler-plugin/artifactId configuration source1.
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
<executions>
<execution>
<id>test-compile</id>
<configuration>
<classPathElements>
<classPathElement>somejar.jar</classPathElement>
</classPathElements>
</configuration>
</execution>
</executions>
</plugin>
试试这个,它包括你项目中的库
<dependency>
<groupId>mylib</groupId>
<artifactId>com.mylib</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/mylib.jar</systemPath>
</dependency>
