diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2011-08-11 15:19:09 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2011-08-11 15:19:09 +0200 |
commit | 6f5eea36bd802edf9961e3e18ef7bc5e2d42b39d (patch) | |
tree | b7230cf71fcc0559ca561b5df621a271670635e0 /sonar-server | |
parent | b75be91784305075e3c2bc00312dcb67377fef56 (diff) | |
download | sonarqube-6f5eea36bd802edf9961e3e18ef7bc5e2d42b39d.tar.gz sonarqube-6f5eea36bd802edf9961e3e18ef7bc5e2d42b39d.zip |
SONAR-2689 Do not support the version 1.0-beta-1 of the Sonar maven plugin anymore
Diffstat (limited to 'sonar-server')
4 files changed, 9 insertions, 76 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/mavendeployer/Artifact.java b/sonar-server/src/main/java/org/sonar/server/mavendeployer/Artifact.java index cf1793dd085..1c953d013c0 100644 --- a/sonar-server/src/main/java/org/sonar/server/mavendeployer/Artifact.java +++ b/sonar-server/src/main/java/org/sonar/server/mavendeployer/Artifact.java @@ -36,26 +36,18 @@ public class Artifact { private String groupId; private String artifactId; protected String version; - private Artifact[] dependencies; protected File jar; private String packaging; - public Artifact(String groupId, String artifactId, String version, String packaging, File jar, Artifact... deps) { + public Artifact(String groupId, String artifactId, String version, String packaging, File jar) { this.artifactId = artifactId; this.groupId = groupId; this.version = version; - this.dependencies = deps; this.jar = jar; this.packaging = packaging; } - public void deployTo(File rootDir, boolean deployDependencies) throws IOException { - if (deployDependencies && dependencies != null) { - for (Artifact dependency : dependencies) { - dependency.deployTo(rootDir, true); - } - } - + public void deployTo(File rootDir) throws IOException { File dir = createDir(rootDir); savePom(dir); saveMetadata(dir); @@ -85,18 +77,6 @@ public class Artifact { return version; } - public Artifact[] getDependencies() { - return dependencies; - } - - public File getJar() { - return jar; - } - - public String getPackaging() { - return packaging; - } - private void saveJar(File dir) throws IOException { if (jar != null) { copyTo(dir); @@ -125,23 +105,13 @@ public class Artifact { } public String getPom() throws IOException { - return transformFromTemplatePath(getTemplatePath(), getDependenciesAsString()); + return transformFromTemplatePath(getTemplatePath()); } protected String getTemplatePath() { return "/org/sonar/server/mavendeployer/pom.template"; } - private String getDependenciesAsString() throws IOException { - StringBuilder sb = new StringBuilder(); - if (dependencies != null) { - for (Artifact dependency : dependencies) { - sb.append(dependency.getXmlDefinition()); - } - } - return sb.toString(); - } - @Override public boolean equals(Object o) { if (this == o) { @@ -179,11 +149,7 @@ public class Artifact { FileUtils.writeStringToFile(metadataFile, getMetadata(), CharEncoding.UTF_8); } - protected String transformFromTemplatePath(String templatePath) throws IOException { - return transformFromTemplatePath(templatePath, ""); - } - - protected final String transformFromTemplatePath(String templatePath, String depsXml) throws IOException { + protected final String transformFromTemplatePath(String templatePath) throws IOException { InputStream template = this.getClass().getResourceAsStream(templatePath); try { String content = IOUtils.toString(template); @@ -192,7 +158,6 @@ public class Artifact { content = StringUtils.replace(content, "$version", version); content = StringUtils.replace(content, "$timestamp", version); content = StringUtils.replace(content, "$packaging", packaging); - content = StringUtils.replace(content, "$dependencies", StringUtils.defaultString(depsXml, "")); return content; } finally { diff --git a/sonar-server/src/main/java/org/sonar/server/mavendeployer/MavenRepository.java b/sonar-server/src/main/java/org/sonar/server/mavendeployer/MavenRepository.java index 8dbd3e57d59..22455c1a057 100644 --- a/sonar-server/src/main/java/org/sonar/server/mavendeployer/MavenRepository.java +++ b/sonar-server/src/main/java/org/sonar/server/mavendeployer/MavenRepository.java @@ -52,7 +52,7 @@ public class MavenRepository { public void start() { try { Artifact maven2Plugin = Mojo.createMaven2Plugin(serverId, installation.getMaven2Plugin()); - maven2Plugin.deployTo(rootDir, false); + maven2Plugin.deployTo(rootDir); } catch (IOException e) { throw new RuntimeException(e); diff --git a/sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java b/sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java index bd90adea321..615dbf4ae52 100644 --- a/sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java +++ b/sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java @@ -28,16 +28,12 @@ import java.io.IOException; public final class Mojo extends Artifact { - private Mojo(String artifactId, String version, File jar, Artifact... deps) { - super(BASE_GROUP_ID, artifactId, version, "maven-plugin", jar, deps); + private Mojo(String artifactId, String version, File jar) { + super(BASE_GROUP_ID, artifactId, version, "maven-plugin", jar); } - public static Mojo createMaven2Plugin(String version, File jar, Artifact... deps) { - return new Mojo("sonar-core-maven-plugin", version, jar, deps); - } - - public static Mojo createMaven3Plugin(String version, File jar, Artifact... deps) { - return new Mojo("sonar-core-maven3-plugin", version, jar, deps); + public static Mojo createMaven2Plugin(String version, File jar) { + return new Mojo("sonar-core-maven-plugin", version, jar); } @Override diff --git a/sonar-server/src/main/resources/org/sonar/server/mavendeployer/sonar-core-maven-plugin.template b/sonar-server/src/main/resources/org/sonar/server/mavendeployer/sonar-core-maven-plugin.template index 1340868f93b..0c59a937c5d 100644 --- a/sonar-server/src/main/resources/org/sonar/server/mavendeployer/sonar-core-maven-plugin.template +++ b/sonar-server/src/main/resources/org/sonar/server/mavendeployer/sonar-core-maven-plugin.template @@ -10,26 +10,6 @@ </distributionManagement> <dependencies> <dependency> - <groupId>org.apache.maven.shared</groupId> - <artifactId>maven-dependency-tree</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>org.codehaus.sonar</groupId> - <artifactId>sonar-batch</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>0.9.15</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>1.5.6</version> - </dependency> - <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> <version>2.0.7</version> @@ -47,13 +27,5 @@ <version>2.0.7</version> <scope>provided</scope> </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.4</version> - </dependency> - - $dependencies - </dependencies> </project>
\ No newline at end of file |