From 4119d71058e5c931367ffb164304bb9fe055934c Mon Sep 17 00:00:00 2001 From: Godin Date: Sat, 16 Oct 2010 23:12:31 +0000 Subject: [PATCH] SONAR-1680: Should be possible to replace dependency provided by sonar-plugin-api --- .../src/it/packageDepsExcludedFromApi/pom.xml | 51 +++++++++++++++++++ .../sonar/plugins/sample/SamplePlugin.java | 30 +++++++++++ .../it/packageDepsExcludedFromApi/verify.bsh | 17 +++++++ 3 files changed, 98 insertions(+) create mode 100644 subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/pom.xml create mode 100644 subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/src/main/java/org/sonar/plugins/sample/SamplePlugin.java create mode 100644 subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/verify.bsh diff --git a/subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/pom.xml b/subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/pom.xml new file mode 100644 index 00000000000..3e530f4e52b --- /dev/null +++ b/subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/pom.xml @@ -0,0 +1,51 @@ + + + 4.0.0 + + org.codehaus.sonar + test + 1.0 + sonar-plugin + Package dependencies + + + + org.codehaus.sonar + sonar-plugin-api + @sonar.version@ + + + org.codehaus.plexus + plexus-utils + + + + + + + org.codehaus.plexus + plexus-utils + 1.5.6 + + + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + true + + org.sonar.plugins.sample.SamplePlugin + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.1 + + + + diff --git a/subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/src/main/java/org/sonar/plugins/sample/SamplePlugin.java b/subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/src/main/java/org/sonar/plugins/sample/SamplePlugin.java new file mode 100644 index 00000000000..31710c3a0e6 --- /dev/null +++ b/subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/src/main/java/org/sonar/plugins/sample/SamplePlugin.java @@ -0,0 +1,30 @@ +package org.sonar.plugins.sample; + +import org.sonar.api.Extension; +import org.sonar.api.Plugin; + +import java.util.Collections; +import java.util.List; + +public class SamplePlugin implements Plugin { + public String getKey() { + return "sample"; + } + + public String getName() { + return "My first Sonar plugin"; + } + + public String getDescription() { + return "You shouldn't expect too much from this plugin."; + } + + public List> getExtensions() { + return Collections.emptyList(); + } + + @Override + public String toString() { + return getKey(); + } +} diff --git a/subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/verify.bsh b/subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/verify.bsh new file mode 100644 index 00000000000..013d05fa6d5 --- /dev/null +++ b/subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/verify.bsh @@ -0,0 +1,17 @@ +import java.io.*; +import java.util.zip.*; + +File file = new File( basedir, "target/test-1.0.jar" ); +if ( !file.isFile() ) +{ + throw new FileNotFoundException( "Could not find generated JAR: " + file ); +} + +ZipFile zipFile = new ZipFile(file); +try { + if (zipFile.getEntry("META-INF/lib/plexus-utils-1.5.6.jar")==null) { + throw new FileNotFoundException("The dependency plexus-utils must be copied in JAR"); + } +} finally { + zipFile.close(); +} -- 2.39.5