加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何将其他类路径依赖项传递给maven中的testCompile阶段

发布时间:2020-12-14 04:47:24 所属栏目:百科 来源:网络整理
导读:我想使用一些外部jar依赖项来编译测试文件,这些依赖项不会出现在pom.xml的依赖项标记中.有没有办法通过配置.像这样的东西 – plugin artifactIdmaven-compiler-plugin/artifactId configuration source1.5/source target1.5/target /configuration execution
我想使用一些外部jar依赖项来编译测试文件,这些依赖项不会出现在pom.xml的依赖项标记中.有没有办法通过配置.像这样的东西 –

<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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读