testable-mock icon indicating copy to clipboard operation
testable-mock copied to clipboard

testable-mock依赖了tools.jar,删除是否有影响

Open ymlsmile opened this issue 3 years ago • 2 comments

maven项目引入testable-mock后发现在copy-dependencies的时候会将tools.jar打包,请问下使用如下方式去掉是否有影响?

    <dependency>
        <groupId>com.alibaba.testable</groupId>
        <artifactId>testable-all</artifactId>
        <version>${testable.version}</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <artifactId>tools</artifactId>
                <groupId>sun.jdk</groupId>
            </exclusion>
        </exclusions>
    </dependency>

ymlsmile avatar Feb 15 '22 05:02 ymlsmile

Testable只有@EnablePrivateAccess注解依赖了sun.jdk包,只要没有用到这个注解,就可以安全移除。

同时由于引入testable-all时候是指定了<scope>test</scope>的,在打工程jar包的时候也不会将testable-all和依赖打到产物里。

linfan avatar Feb 20 '22 12:02 linfan

Testable只有@EnablePrivateAccess注解依赖了sun.jdk包,只要没有用到这个注解,就可以安全移除。

同时由于引入testable-all时候是指定了<scope>test</scope>的,在打工程jar包的时候也不会将testable-all和依赖打到产物里。

好的,使用过程中发现使用maven-dependency-plugin插件的时候会将sun.jdk包引入进来

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-dependency-plugin</artifactId>
	<executions>
		<execution>
			<id>copy-dependencies</id>
			<phase>package</phase>
			<goals>
				<goal>copy-dependencies</goal>
			</goals>
			<configuration>
				<outputDirectory>${assemblyDirectory}/${serviceId}/lib/</outputDirectory>
				<stripVersion>true</stripVersion>
                                <includeScope>compile</includeScope>
			</configuration>
		</execution>
	</executions>
</plugin>

ymlsmile avatar Feb 22 '22 01:02 ymlsmile