diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-11-05 12:30:18 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-11-05 18:37:51 +0100 |
commit | 266e3139c3ef6112d43d3422489a0654937b1816 (patch) | |
tree | 307cd66d2cb3c129b5bfe94f88883b1046df7446 /plugins | |
parent | a98d46a8aa838cd2b209e66347794778017ed88c (diff) | |
download | sonarqube-266e3139c3ef6112d43d3422489a0654937b1816.tar.gz sonarqube-266e3139c3ef6112d43d3422489a0654937b1816.zip |
SONAR-6998 Remove injection of MavenProject in module IoC container
Diffstat (limited to 'plugins')
3 files changed, 0 insertions, 149 deletions
diff --git a/plugins/sonar-batch-maven-plugin/pom.xml b/plugins/sonar-batch-maven-plugin/pom.xml deleted file mode 100644 index 52fd352bfb2..00000000000 --- a/plugins/sonar-batch-maven-plugin/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.sonarsource.sonarqube</groupId> - <artifactId>sonarqube</artifactId> - <version>5.3-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <artifactId>sonar-batch-maven-plugin</artifactId> - <name>SonarQube :: Batch Maven Plugin</name> - <packaging>sonar-plugin</packaging> - <description>Inject MavenProject in each module.</description> - - <dependencies> - <dependency> - <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>sonar-plugin-api</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-core</artifactId> - <version>3.0</version> - <scope>provided</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId> - <artifactId>sonar-packaging-maven-plugin</artifactId> - <configuration> - <pluginKey>mavenbatch</pluginKey> - <pluginName>Maven Batch</pluginName> - <pluginClass>org.sonar.plugins.batch.maven.MavenBatchPlugin</pluginClass> - <pluginDescription> - <![CDATA[Inject MavenProject in each module.]]></pluginDescription> - </configuration> - </plugin> - </plugins> - </build> -</project> diff --git a/plugins/sonar-batch-maven-plugin/src/main/java/org/sonar/plugins/batch/maven/MavenBatchPlugin.java b/plugins/sonar-batch-maven-plugin/src/main/java/org/sonar/plugins/batch/maven/MavenBatchPlugin.java deleted file mode 100644 index 5fd1c17484d..00000000000 --- a/plugins/sonar-batch-maven-plugin/src/main/java/org/sonar/plugins/batch/maven/MavenBatchPlugin.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.plugins.batch.maven; - -import org.sonar.api.SonarPlugin; - -import java.util.Arrays; -import java.util.List; - -public class MavenBatchPlugin extends SonarPlugin { - - @Override - public List getExtensions() { - return Arrays.asList(MavenProjectBuilder.class); - } - -} diff --git a/plugins/sonar-batch-maven-plugin/src/main/java/org/sonar/plugins/batch/maven/MavenProjectBuilder.java b/plugins/sonar-batch-maven-plugin/src/main/java/org/sonar/plugins/batch/maven/MavenProjectBuilder.java deleted file mode 100644 index 6efa5cbfc37..00000000000 --- a/plugins/sonar-batch-maven-plugin/src/main/java/org/sonar/plugins/batch/maven/MavenProjectBuilder.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.plugins.batch.maven; - -import org.apache.maven.execution.MavenSession; -import org.apache.maven.project.MavenProject; -import org.sonar.api.batch.SupportedEnvironment; -import org.sonar.api.batch.bootstrap.ProjectBuilder; -import org.sonar.api.batch.bootstrap.ProjectDefinition; -import org.sonar.api.batch.bootstrap.ProjectReactor; - -import java.util.List; - -/** - * Class that inject MavenProject in each module container - */ -@SupportedEnvironment("maven") -public class MavenProjectBuilder extends ProjectBuilder { - - private final MavenSession mavenSession; - - public MavenProjectBuilder(MavenSession mavenSession) { - this.mavenSession = mavenSession; - } - - @Override - public void build(Context context) { - ProjectReactor reactor = context.projectReactor(); - for (ProjectDefinition moduleDef : reactor.getProjects()) { - setMavenProjectIfApplicable(moduleDef); - } - } - - private void setMavenProjectIfApplicable(ProjectDefinition definition) { - if (mavenSession != null) { - String moduleKey = definition.getKey(); - for (MavenProject mavenModule : (List<MavenProject>) mavenSession.getProjects()) { - // FIXME assumption that moduleKey was not modified by user and follow convention <groupId>:<artifactId> - String mavenModuleKey = mavenModule.getGroupId() + ":" + mavenModule.getArtifactId(); - if (mavenModuleKey.equals(moduleKey) && !definition.getContainerExtensions().contains(mavenModule)) { - definition.addContainerExtension(mavenModule); - } - } - } - } - -} |