]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-1680: Should be possible to replace dependency provided by sonar-plugin-api
authorGodin <mandrikov@gmail.com>
Sat, 16 Oct 2010 23:12:31 +0000 (23:12 +0000)
committerGodin <mandrikov@gmail.com>
Sat, 16 Oct 2010 23:12:31 +0000 (23:12 +0000)
subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/pom.xml [new file with mode: 0644]
subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/src/main/java/org/sonar/plugins/sample/SamplePlugin.java [new file with mode: 0644]
subprojects/sonar-update-center/sonar-packaging-maven-plugin/src/it/packageDepsExcludedFromApi/verify.bsh [new file with mode: 0644]

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 (file)
index 0000000..3e530f4
--- /dev/null
@@ -0,0 +1,51 @@
+<?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/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.codehaus.sonar</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+  <packaging>sonar-plugin</packaging>
+  <name>Package dependencies</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.sonar</groupId>
+      <artifactId>sonar-plugin-api</artifactId>
+      <version>@sonar.version@</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.codehaus.plexus</groupId>
+          <artifactId>plexus-utils</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <!-- Should be included into jar -->
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.5.6</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>@project.groupId@</groupId>
+        <artifactId>@project.artifactId@</artifactId>
+        <version>@project.version@</version>
+        <extensions>true</extensions>
+        <configuration>
+          <pluginClass>org.sonar.plugins.sample.SamplePlugin</pluginClass>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.3.1</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>
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 (file)
index 0000000..31710c3
--- /dev/null
@@ -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<Class<? extends Extension>> 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 (file)
index 0000000..013d05f
--- /dev/null
@@ -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();
+}