Skip to content

Commit

Permalink
SONAR-3821 Drop any Maven dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
henryju committed Jun 3, 2015
1 parent 4490f31 commit 5dd7b6e
Show file tree
Hide file tree
Showing 49 changed files with 107 additions and 2,539 deletions.
53 changes: 53 additions & 0 deletions plugins/sonar-batch-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?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.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
<version>5.2-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>

<groupId>org.codehaus.sonar.plugins</groupId>
<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>org.codehaus.sonar</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.codehaus.sonar</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>
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@
* 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;

/**
* This package is a part of bootstrap process, so we should take care about backward compatibility.
*/
@ParametersAreNonnullByDefault
package org.sonar.batch.maven;
import org.sonar.api.SonarPlugin;

import java.util.Arrays;
import java.util.List;

public class MavenBatchPlugin extends SonarPlugin {

import javax.annotation.ParametersAreNonnullByDefault;
@Override
public List getExtensions() {
return Arrays.asList(MavenProjectBuilder.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* 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.batch.maven;
package org.sonar.plugins.batch.maven;

import org.apache.maven.execution.MavenSession;
import org.apache.maven.project.MavenProject;
Expand Down Expand Up @@ -51,7 +51,8 @@ public void build(Context context) {
private void setMavenProjectIfApplicable(ProjectDefinition definition) {
if (mavenSession != null) {
String moduleKey = definition.getKey();
for (MavenProject mavenModule : (List<MavenProject>) mavenSession.getSortedProjects()) {
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);
Expand Down
67 changes: 13 additions & 54 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<module>sonar-plugin-api-deps</module>
<module>sonar-application</module>
<module>sonar-batch</module>
<module>sonar-batch-maven-compat</module>
<module>sonar-batch-protocol</module>
<module>sonar-batch-shaded</module>
<module>sonar-check-api</module>
<module>sonar-colorizer</module>
<module>sonar-core</module>
Expand All @@ -29,6 +29,7 @@
<module>sonar-testing-harness</module>
<module>plugins/sonar-email-notifications-plugin</module>
<module>plugins/sonar-xoo-plugin</module>
<module>plugins/sonar-batch-maven-plugin</module>
</modules>

<organization>
Expand Down Expand Up @@ -163,7 +164,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.9</version>
<version>2.10</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -392,14 +393,6 @@
</excludes>
<searchTransitive>true</searchTransitive>
</bannedDependencies>
<bannedDependencies>
<!-- See SONAR-2455 -->
<message>org.codehaus.plexus:plexus-classworlds should be used instead</message>
<excludes>
<exclude>classworlds:classworlds</exclude>
</excludes>
<searchTransitive>true</searchTransitive>
</bannedDependencies>
<requireNoRepositories>
<message>Definition of new repositories is not allowed in order to deploy to central repository.
</message>
Expand Down Expand Up @@ -784,6 +777,16 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
Expand Down Expand Up @@ -984,50 +987,6 @@
<artifactId>xpp3</artifactId>
<version>1.1.3.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven.api.version}</version>
<exclusions>
<exclusion>
<!-- See SONAR-2455 -->
<groupId>classworlds</groupId>
<artifactId>classworlds</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${maven.api.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>${maven.api.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>${maven.api.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-dependency-tree</artifactId>
<version>2.1</version>
<exclusions>
<exclusion>
<!-- See SONAR-2455 -->
<groupId>classworlds</groupId>
<artifactId>classworlds</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-common-artifact-filters</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sonar-batch-maven-compat-4.4.jar|2d7cbec208114970ea419ce963775f68
sonar-batch-4.4.jar|2d7cbec208114970ea419ce963775f68
sonar-batch-library-2.3.jar|86f577369ec914ae079411803cebc7d2
14 changes: 1 addition & 13 deletions sonar-application/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@
<outputDirectory>lib/common</outputDirectory>
<useTransitiveFiltering>true</useTransitiveFiltering>
<useProjectArtifact>false</useProjectArtifact>
<excludes>
<exclude>mysql:mysql-connector-java</exclude>
<exclude>org.postgresql:postgresql</exclude>
<exclude>net.sourceforge.jtds:jtds</exclude>
<exclude>tanukisoft:wrapper</exclude>
<exclude>org.codehaus.sonar:sonar-server</exclude>
<exclude>org.codehaus.sonar:sonar-web</exclude>
<exclude>org.codehaus.sonar:sonar-search</exclude>
<exclude>org.codehaus.sonar.plugins:*</exclude>
<exclude>org.codehaus.sonar-plugins.java:*</exclude>
<exclude>org.sonatype.jsw-binaries:jsw-binaries</exclude>
</excludes>
<scope>runtime</scope>
</dependencySet>

Expand Down Expand Up @@ -85,7 +73,7 @@
<outputDirectory>lib/batch</outputDirectory>
<useTransitiveDependencies>false</useTransitiveDependencies>
<includes>
<include>org.codehaus.sonar:sonar-batch-maven-compat</include>
<include>org.codehaus.sonar:sonar-batch-shaded</include>
</includes>
<scope>provided</scope>
</dependencySet>
Expand Down
2 changes: 1 addition & 1 deletion sonar-application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</dependency>
<dependency>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-batch-maven-compat</artifactId>
<artifactId>sonar-batch-shaded</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
Expand Down
16 changes: 3 additions & 13 deletions sonar-batch-maven-compat/pom.xml → sonar-batch-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,16 @@
<version>5.2-SNAPSHOT</version>
</parent>

<artifactId>sonar-batch-maven-compat</artifactId>
<name>SonarQube :: Batch Maven Compat</name>
<description>Compatibility layer, which provides MavenProject for non-Maven environments.</description>
<artifactId>sonar-batch-shaded</artifactId>
<name>SonarQube :: Batch Shaded</name>
<description>All batch dependencies in a single jar</description>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sonar-batch</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
Expand Down
20 changes: 0 additions & 20 deletions sonar-batch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,6 @@
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-dependency-tree</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
Expand Down
12 changes: 0 additions & 12 deletions sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.sonar.batch;

import org.apache.commons.lang.StringUtils;
import org.apache.maven.project.MavenProject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.batch.BatchSide;
Expand Down Expand Up @@ -64,18 +63,7 @@ public ProjectConfigurator(Settings settings, System2 system2) {

public Project create(ProjectDefinition definition) {
Project project = new Project(definition.getKey(), loadProjectBranch(), definition.getName());

// For backward compatibility we must set POM and actual packaging
project.setDescription(StringUtils.defaultString(definition.getDescription()));
project.setPackaging("jar");

for (Object component : definition.getContainerExtensions()) {
if (component instanceof MavenProject) {
MavenProject pom = (MavenProject) component;
project.setPom(pom);
project.setPackaging(pom.getPackaging());
}
}
return project;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@
import org.sonar.batch.issue.tracking.IssueTracking;
import org.sonar.batch.issue.tracking.IssueTrackingDecorator;
import org.sonar.batch.language.LanguageDistributionDecorator;
import org.sonar.batch.maven.MavenProjectBootstrapper;
import org.sonar.batch.maven.MavenProjectBuilder;
import org.sonar.batch.maven.MavenProjectConverter;
import org.sonar.batch.qualitygate.GenerateQualityGateEvents;
import org.sonar.batch.qualitygate.QualityGateVerifier;
import org.sonar.batch.rule.QProfileEventsDecorator;
Expand All @@ -85,10 +82,6 @@ private BatchComponents() {
public static Collection all(DefaultAnalysisMode analysisMode) {
List components = Lists.newArrayList(
DefaultResourceTypes.get(),

// Maven
MavenProjectBootstrapper.class, MavenProjectConverter.class, MavenProjectBuilder.class,

// SCM
ScmConfiguration.class,
ScmSensor.class,
Expand Down
Loading

0 comments on commit 5dd7b6e

Please sign in to comment.