revert maven plugin pom change

This commit is contained in:
金戟 2020-12-10 16:11:14 +08:00
parent c8115f9623
commit dfb1e2c094
3 changed files with 21 additions and 35 deletions

View File

@ -3,43 +3,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba.testable</groupId>
<parent>
<groupId>com.alibaba.testable</groupId>
<artifactId>testable-parent</artifactId>
<version>0.3.3-SNAPSHOT</version>
<relativePath>../testable-parent</relativePath>
</parent>
<artifactId>testable-maven-plugin</artifactId>
<version>0.3.3-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>testable-maven-plugin</name>
<description>Maven plugin for TestableMock</description>
<url>https://github.com/alibaba/testable-mock</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/alibaba/testable-mock/blob/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>金戟</name>
<email>jinji.lf@alibaba-inc.com</email>
</developer>
</developers>
<scm>
<connection>scm:git:git@github.com:alibaba/testable-mock.git</connection>
<url>git@github.com:alibaba/testable-mock.git</url>
<tag>HEAD</tag>
</scm>
<properties>
<java.version>1.6</java.version>
<project.compiler.level>1.6</project.compiler.level>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<plugin.compiler.version>3.8.1</plugin.compiler.version>
<plugin.maven.version>3.6.0</plugin.maven.version>
<plugin.source.version>3.2.0</plugin.source.version>
<plugin.javadoc.version>3.2.0</plugin.javadoc.version>
<plugin.gpg.version>1.6</plugin.gpg.version>
<plugin.staging.version>1.6.8</plugin.staging.version>
</properties>
<dependencies>
<dependency>
@ -58,6 +30,11 @@
<version>3.6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.alibaba.testable</groupId>
<artifactId>testable-agent</artifactId>
<version>${testable.version}</version>
</dependency>
</dependencies>
<build>

View File

@ -48,18 +48,26 @@ public class TestableMojo extends AbstractMojo
*/
private static final String ECLIPSE_TEST_PLUGIN = "eclipse-test-plugin";
@Override
public void execute() throws MojoExecutionException
{
final String testArgsPropertyKey = getEffectivePropertyKey();
final Properties projectProperties = project.getProperties();
if (projectProperties == null) {
getLog().error("failed to fetch project properties");
return;
}
final String oldArgs = projectProperties.getProperty(testArgsPropertyKey);
final String newArgs = (oldArgs == null) ? getAgentJarArgs().trim() : oldArgs + getAgentJarArgs();
final String newArgs = (oldArgs == null) ? getAgentJarArgs().trim() : (oldArgs + getAgentJarArgs());
getLog().info(testArgsPropertyKey + " set to " + newArgs);
projectProperties.setProperty(testArgsPropertyKey, newArgs);
}
private String getAgentJarArgs() {
final Artifact testableAgentArtifact = pluginArtifactMap.get(AGENT_ARTIFACT_NAME);
if (testableAgentArtifact == null) {
getLog().error("failed to find testable agent jar");
}
return " -javaagent:" + testableAgentArtifact.getFile().getAbsolutePath();
}

View File

@ -41,6 +41,7 @@
<plugin.javadoc.version>3.2.0</plugin.javadoc.version>
<plugin.gpg.version>1.6</plugin.gpg.version>
<plugin.staging.version>1.6.8</plugin.staging.version>
<plugin.maven.version>3.6.0</plugin.maven.version>
<testable.version>0.3.3-SNAPSHOT</testable.version>
</properties>