diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-10-23 18:28:13 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-10-23 21:18:27 +0200 |
commit | 4c3993eb0204b526be90108a1185e691596ef06c (patch) | |
tree | 62ad76970d10ddcafd144b03e2514a69f80f4b0e | |
parent | ff739ecc971cf8a9d610477cd414569540fe88b8 (diff) | |
download | sonarqube-4c3993eb0204b526be90108a1185e691596ef06c.tar.gz sonarqube-4c3993eb0204b526be90108a1185e691596ef06c.zip |
SONAR-5705 Drop support of Maven 2
-rw-r--r-- | plugins/sonar-core-plugin/pom.xml | 10 | ||||
-rw-r--r-- | plugins/sonar-cpd-plugin/pom.xml | 5 | ||||
-rw-r--r-- | plugins/sonar-dbcleaner-plugin/pom.xml | 2 | ||||
-rw-r--r-- | pom.xml | 39 | ||||
-rw-r--r-- | sonar-batch-maven-compat/pom.xml | 3 | ||||
-rw-r--r-- | sonar-batch/pom.xml | 10 | ||||
-rw-r--r-- | sonar-deprecated/pom.xml | 4 | ||||
-rw-r--r-- | sonar-maven-plugin/pom.xml | 76 | ||||
-rw-r--r-- | sonar-maven-plugin/src/main/java/org/sonar/maven/ExceptionHandling.java | 43 | ||||
-rw-r--r-- | sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java | 220 | ||||
-rw-r--r-- | sonar-maven-plugin/src/test/java/org/sonar/maven/ExceptionHandlingTest.java | 75 | ||||
-rw-r--r-- | sonar-maven-plugin/src/test/java/org/sonar/maven/SonarMojoTest.java | 46 | ||||
-rw-r--r-- | sonar-maven-plugin/src/test/java/org/sonar/runner/impl/RunnerException.java | 26 | ||||
-rw-r--r-- | sonar-maven3-plugin/pom.xml | 19 | ||||
-rw-r--r-- | sonar-plugin-api/pom.xml | 2 |
15 files changed, 20 insertions, 560 deletions
diff --git a/plugins/sonar-core-plugin/pom.xml b/plugins/sonar-core-plugin/pom.xml index e1c90fc7808..ad614e1b4e9 100644 --- a/plugins/sonar-core-plugin/pom.xml +++ b/plugins/sonar-core-plugin/pom.xml @@ -41,14 +41,14 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.codehaus.sonar</groupId> - <artifactId>sonar-batch</artifactId> - <version>${project.version}</version> + <groupId>jfree</groupId> + <artifactId>jfreechart</artifactId> <scope>provided</scope> </dependency> <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-batch</artifactId> + <version>${project.version}</version> <scope>provided</scope> </dependency> <dependency> diff --git a/plugins/sonar-cpd-plugin/pom.xml b/plugins/sonar-cpd-plugin/pom.xml index 0cbacd25785..686a6314274 100644 --- a/plugins/sonar-cpd-plugin/pom.xml +++ b/plugins/sonar-cpd-plugin/pom.xml @@ -22,6 +22,11 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-core</artifactId> + <scope>provided</scope> + </dependency> + <dependency> <groupId>com.google.code.findbugs</groupId> <artifactId>jsr305</artifactId> <scope>provided</scope> diff --git a/plugins/sonar-dbcleaner-plugin/pom.xml b/plugins/sonar-dbcleaner-plugin/pom.xml index 420f5e189bc..b968b020ef7 100644 --- a/plugins/sonar-dbcleaner-plugin/pom.xml +++ b/plugins/sonar-dbcleaner-plugin/pom.xml @@ -65,7 +65,7 @@ --> <dependency> <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> + <artifactId>maven-core</artifactId> <scope>test</scope> </dependency> <dependency> @@ -25,8 +25,6 @@ <module>sonar-home</module> <module>sonar-java-api</module> <module>sonar-markdown</module> - <module>sonar-maven-plugin</module> - <module>sonar-maven3-plugin</module> <module>sonar-plugin-api</module> <module>server</module> <module>sonar-testing-harness</module> @@ -80,7 +78,7 @@ <elasticsearch.version>1.1.2</elasticsearch.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.min.version>3.0.5</maven.min.version> - <maven.api.version>2.2.0</maven.api.version> + <maven.api.version>3.0.5</maven.api.version> <jdk.min.version>1.6</jdk.min.version> <timestamp>${maven.build.timestamp}</timestamp> <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format> @@ -934,44 +932,13 @@ </dependency> <dependency> <groupId>org.apache.maven</groupId> - <artifactId>maven-artifact</artifactId> + <artifactId>maven-compat</artifactId> <version>${maven.api.version}</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> + <artifactId>maven-artifact</artifactId> <version>${maven.api.version}</version> - <exclusions> - <exclusion> - <!-- See SONAR-2455 --> - <groupId>classworlds</groupId> - <artifactId>classworlds</artifactId> - </exclusion> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - <exclusion> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-core</artifactId> - </exclusion> - <exclusion> - <groupId>backport-util-concurrent</groupId> - <artifactId>backport-util-concurrent</artifactId> - </exclusion> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-interpolation</artifactId> - </exclusion> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.maven</groupId> - <artifactId>maven-artifact-manager</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> <groupId>org.apache.maven.shared</groupId> diff --git a/sonar-batch-maven-compat/pom.xml b/sonar-batch-maven-compat/pom.xml index 5abd74b6beb..c5b23e3e95e 100644 --- a/sonar-batch-maven-compat/pom.xml +++ b/sonar-batch-maven-compat/pom.xml @@ -20,8 +20,7 @@ </dependency> <dependency> <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> - <version>2.0.7</version> + <artifactId>maven-core</artifactId> <exclusions> <exclusion> <groupId>org.codehaus.plexus</groupId> diff --git a/sonar-batch/pom.xml b/sonar-batch/pom.xml index 8fad314ca6e..3d95250a29d 100644 --- a/sonar-batch/pom.xml +++ b/sonar-batch/pom.xml @@ -89,23 +89,21 @@ <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> - <version>3.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-core</artifactId> - <version>3.0</version> <scope>provided</scope> </dependency> <dependency> - <groupId>org.apache.maven.shared</groupId> - <artifactId>maven-dependency-tree</artifactId> + <groupId>org.apache.maven</groupId> + <artifactId>maven-compat</artifactId> <scope>provided</scope> </dependency> <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-dependency-tree</artifactId> <scope>provided</scope> </dependency> <dependency> diff --git a/sonar-deprecated/pom.xml b/sonar-deprecated/pom.xml index 9a80e797996..9c6a5c639fe 100644 --- a/sonar-deprecated/pom.xml +++ b/sonar-deprecated/pom.xml @@ -19,10 +19,6 @@ <artifactId>jfreechart</artifactId> </dependency> <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> - </dependency> - <dependency> <groupId>com.google.code.findbugs</groupId> <artifactId>jsr305</artifactId> <scope>provided</scope> diff --git a/sonar-maven-plugin/pom.xml b/sonar-maven-plugin/pom.xml deleted file mode 100644 index 06e8f96152d..00000000000 --- a/sonar-maven-plugin/pom.xml +++ /dev/null @@ -1,76 +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.codehaus.sonar</groupId> - <artifactId>sonar</artifactId> - <version>5.0-SNAPSHOT</version> - </parent> - <artifactId>sonar-maven-plugin</artifactId> - <packaging>maven-plugin</packaging> - <name>SonarQube :: Maven2 Plugin</name> - - <dependencies> - <dependency> - <groupId>org.apache.maven.shared</groupId> - <artifactId>maven-dependency-tree</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.sonar.runner</groupId> - <artifactId>sonar-runner-api</artifactId> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</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-project</artifactId> - <scope>provided</scope> - </dependency> - - <!-- Test --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <skipTests>${skipBatchTests}</skipTests> - </configuration> - </plugin> - </plugins> - </build> -</project> diff --git a/sonar-maven-plugin/src/main/java/org/sonar/maven/ExceptionHandling.java b/sonar-maven-plugin/src/main/java/org/sonar/maven/ExceptionHandling.java deleted file mode 100644 index c5d0f71ab4d..00000000000 --- a/sonar-maven-plugin/src/main/java/org/sonar/maven/ExceptionHandling.java +++ /dev/null @@ -1,43 +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.maven; - -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.logging.Log; - -class ExceptionHandling { - - private ExceptionHandling(){ - // Hide public constructor - } - - static RuntimeException handle(Exception e, Log log) throws MojoExecutionException { - Throwable source = e; - if ("org.sonar.runner.impl.RunnerException".equals(e.getClass().getName()) && e.getCause() != null) { - source = e.getCause(); - } - log.error(source.getMessage()); - throw new MojoExecutionException(source.getMessage(), source); - } - - static RuntimeException handle(String message, Log log) throws MojoExecutionException { - return handle(new MojoExecutionException(message), log); - } -} diff --git a/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java b/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java deleted file mode 100644 index 5a2c09acb45..00000000000 --- a/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java +++ /dev/null @@ -1,220 +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.maven; - -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactCollector; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.execution.RuntimeInformation; -import org.apache.maven.lifecycle.LifecycleExecutor; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.MavenProjectBuilder; -import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder; -import org.sonar.runner.api.EmbeddedRunner; -import org.sonar.runner.api.RunnerProperties; -import org.sonar.runner.api.ScanProperties; - -import java.io.File; -import java.io.IOException; - -/** - * @goal sonar - * @aggregator - * @requiresDependencyResolution test - * @deprecated Only kept for backward compatibility with old version of SQ Maven plugin - */ -@Deprecated -public final class SonarMojo extends AbstractMojo { - - /** - * @parameter property="session" - * @required - * @readonly - */ - private MavenSession session; - - /** - * @parameter property="project" - * @required - * @readonly - */ - private MavenProject project; - - /** - * @component - * @required - */ - private LifecycleExecutor lifecycleExecutor; - - /** - * The artifact factory to use. - * - * @component - * @required - * @readonly - */ - private ArtifactFactory artifactFactory; - - /** - * The artifact repository to use. - * - * @parameter property="localRepository" - * @required - * @readonly - */ - private ArtifactRepository localRepository; - - /** - * The artifact metadata source to use. - * - * @component - * @required - * @readonly - */ - private ArtifactMetadataSource artifactMetadataSource; - - /** - * The artifact collector to use. - * - * @component - * @required - * @readonly - */ - private ArtifactCollector artifactCollector; - - /** - * The dependency tree builder to use. - * - * @component - * @required - * @readonly - */ - private DependencyTreeBuilder dependencyTreeBuilder; - - /** - * @component - * @required - * @readonly - */ - private MavenProjectBuilder projectBuilder; - - /** - * @component - * @required - * @readonly - * @VisibleForTesting - */ - RuntimeInformation runtimeInformation; - - @Override - public void execute() throws MojoExecutionException { - ArtifactVersion mavenVersion = getMavenVersion(); - if (mavenVersion.getMajorVersion() == 2 && mavenVersion.getMinorVersion() < 2) { - ExceptionHandling.handle("Please use at least Maven 2.2.x to perform SonarQube analysis (current version is " + mavenVersion.toString() + ")", getLog()); - } - - try { - EmbeddedRunner runner = EmbeddedRunner.create() - .setApp("Maven", mavenVersion.toString()) - .addProperties(session.getExecutionProperties()) - .addProperties(project.getModel().getProperties()) - // Add user properties (ie command line arguments -Dsonar.xxx=yyyy) in last position to override all other - .addProperties(session.getUserProperties()); - String encoding = getSourceEncoding(project); - if (encoding != null) { - runner.setProperty(ScanProperties.PROJECT_SOURCE_ENCODING, encoding); - } - runner - .setProperty(ScanProperties.PROJECT_KEY, getSonarKey(project)) - .setProperty(RunnerProperties.WORK_DIR, getSonarWorkDir(project).getAbsolutePath()) - .setProperty(ScanProperties.PROJECT_BASEDIR, project.getBasedir().getAbsolutePath()) - .setProperty(ScanProperties.PROJECT_VERSION, toString(project.getVersion())) - .setProperty(ScanProperties.PROJECT_NAME, toString(project.getName())) - .setProperty(ScanProperties.PROJECT_DESCRIPTION, toString(project.getDescription())) - .setProperty(ScanProperties.PROJECT_SOURCE_DIRS, "."); - // Exclude log implementation to not conflict with Maven 3.1 logging impl - runner.mask("org.slf4j.LoggerFactory") - // Include slf4j Logger that is exposed by some Sonar components - .unmask("org.slf4j.Logger") - .unmask("org.slf4j.ILoggerFactory") - // Exclude other slf4j classes - // .unmask("org.slf4j.impl.") - .mask("org.slf4j.") - // Exclude logback - .mask("ch.qos.logback.") - .mask("org.sonar.") - // Include everything else - .unmask(""); - runner.addExtensions(session, getLog(), lifecycleExecutor, artifactFactory, localRepository, artifactMetadataSource, artifactCollector, - dependencyTreeBuilder, projectBuilder); - if (getLog().isDebugEnabled()) { - runner.setProperty("sonar.verbose", "true"); - } - runner.execute(); - } catch (Exception e) { - throw ExceptionHandling.handle(e, getLog()); - } - } - - private ArtifactVersion getMavenVersion() { - return runtimeInformation.getApplicationVersion(); - } - - public static String toString(Object obj) { - return obj == null ? "" : obj.toString(); - } - - public static String getSourceEncoding(MavenProject pom) { - return pom.getProperties().getProperty("project.build.sourceEncoding"); - } - - public static String getSonarKey(MavenProject pom) { - return new StringBuilder().append(pom.getGroupId()).append(":").append(pom.getArtifactId()).toString(); - } - - public static File getSonarWorkDir(MavenProject pom) { - return new File(getBuildDir(pom), "sonar"); - } - - private static File getBuildDir(MavenProject pom) { - return resolvePath(pom.getBuild().getDirectory(), pom.getBasedir()); - } - - static File resolvePath(String path, File basedir) { - if (path != null) { - File file = new File(path); - if (!file.isAbsolute()) { - try { - file = new File(basedir, path).getCanonicalFile(); - } catch (IOException e) { - throw new IllegalStateException("Unable to resolve path '" + path + "'", e); - } - } - return file; - } - return null; - } - -} diff --git a/sonar-maven-plugin/src/test/java/org/sonar/maven/ExceptionHandlingTest.java b/sonar-maven-plugin/src/test/java/org/sonar/maven/ExceptionHandlingTest.java deleted file mode 100644 index 78db2d14675..00000000000 --- a/sonar-maven-plugin/src/test/java/org/sonar/maven/ExceptionHandlingTest.java +++ /dev/null @@ -1,75 +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.maven; - -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.logging.Log; -import org.junit.Test; -import org.sonar.runner.impl.RunnerException; - -import static org.fest.assertions.Assertions.assertThat; -import static org.fest.assertions.Fail.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -public class ExceptionHandlingTest { - - private static final String MESSAGE = "the error message"; - - @Test - public void should_log_message_and_throw_exception() throws Exception { - Log log = mock(Log.class); - try { - ExceptionHandling.handle(MESSAGE, log); - fail(); - } catch (MojoExecutionException e) { - assertThat(e.getMessage()).isEqualTo(MESSAGE); - verify(log).error(MESSAGE); - } - } - - @Test - public void should_log_message_and_rethrow_exception() throws Exception { - Log log = mock(Log.class); - IllegalStateException cause = new IllegalStateException(MESSAGE); - try { - ExceptionHandling.handle(cause, log); - fail(); - } catch (MojoExecutionException e) { - assertThat(e.getMessage()).isEqualTo(MESSAGE); - assertThat(e.getCause()).isSameAs(cause); - verify(log).error(MESSAGE); - } - } - - @Test - public void should_hide_sonar_runner_stacktrace() throws Exception { - Log log = mock(Log.class); - IllegalStateException cause = new IllegalStateException(MESSAGE); - try { - ExceptionHandling.handle(new RunnerException(cause), log); - fail(); - } catch (MojoExecutionException e) { - assertThat(e.getMessage()).isEqualTo(MESSAGE); - assertThat(e.getCause()).isSameAs(cause); - verify(log).error(MESSAGE); - } - } -} diff --git a/sonar-maven-plugin/src/test/java/org/sonar/maven/SonarMojoTest.java b/sonar-maven-plugin/src/test/java/org/sonar/maven/SonarMojoTest.java deleted file mode 100644 index 7b1be21b330..00000000000 --- a/sonar-maven-plugin/src/test/java/org/sonar/maven/SonarMojoTest.java +++ /dev/null @@ -1,46 +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.maven; - -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.apache.maven.execution.RuntimeInformation; -import org.apache.maven.plugin.MojoExecutionException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class SonarMojoTest { - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @Test - public void shouldFailWithOldMavenVersion() throws Exception { - SonarMojo mojo = new SonarMojo(); - mojo.runtimeInformation = mock(RuntimeInformation.class); - when(mojo.runtimeInformation.getApplicationVersion()).thenReturn(new DefaultArtifactVersion("2.0.11")); - thrown.expect(MojoExecutionException.class); - thrown.expectMessage("Please use at least Maven 2.2.x to perform SonarQube analysis (current version is 2.0.11)"); - mojo.execute(); - } -} diff --git a/sonar-maven-plugin/src/test/java/org/sonar/runner/impl/RunnerException.java b/sonar-maven-plugin/src/test/java/org/sonar/runner/impl/RunnerException.java deleted file mode 100644 index 7208f75891d..00000000000 --- a/sonar-maven-plugin/src/test/java/org/sonar/runner/impl/RunnerException.java +++ /dev/null @@ -1,26 +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.runner.impl; - -public class RunnerException extends RuntimeException { - public RunnerException(Throwable throwable) { - super(throwable); - } -} diff --git a/sonar-maven3-plugin/pom.xml b/sonar-maven3-plugin/pom.xml deleted file mode 100644 index 5863d5bbe36..00000000000 --- a/sonar-maven3-plugin/pom.xml +++ /dev/null @@ -1,19 +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.codehaus.sonar</groupId> - <artifactId>sonar</artifactId> - <version>5.0-SNAPSHOT</version> - </parent> - <artifactId>sonar-maven3-plugin</artifactId> - <packaging>pom</packaging> - <name>SonarQube :: Maven3 Plugin</name> - <!-- Since Sonar 3.7 there is no more difference between Maven 2 and Maven 3 so relocate to Maven 2 plugin to avoid duplication --> - <distributionManagement> - <relocation> - <artifactId>sonar-maven-plugin</artifactId> - </relocation> - </distributionManagement> - -</project> diff --git a/sonar-plugin-api/pom.xml b/sonar-plugin-api/pom.xml index 454e3599fb3..76316a3e95e 100644 --- a/sonar-plugin-api/pom.xml +++ b/sonar-plugin-api/pom.xml @@ -72,7 +72,7 @@ </dependency> <dependency> <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> + <artifactId>maven-core</artifactId> <scope>provided</scope> </dependency> |