aboutsummaryrefslogtreecommitdiffstats
path: root/bundle-plugin-test
diff options
context:
space:
mode:
Diffstat (limited to 'bundle-plugin-test')
-rw-r--r--bundle-plugin-test/integration-test/pom.xml92
-rw-r--r--bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/BundleTest.java (renamed from bundle-plugin-test/src/test/java/com/yahoo/BundleIT.java)55
-rw-r--r--bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/ExportPackageVersionTest.java72
-rw-r--r--bundle-plugin-test/pom.xml80
-rw-r--r--bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/pom.xml37
-rw-r--r--bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/src/main/java/ai/vespa/explicitversion_dep/package-info.java6
-rw-r--r--bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/src/main/java/ai/vespa/noversion_dep/package-info.java5
-rw-r--r--bundle-plugin-test/test-bundles/artifact-version-for-exports/pom.xml36
-rw-r--r--bundle-plugin-test/test-bundles/artifact-version-for-exports/src/main/java/ai/vespa/explicitversion/package-info.java6
-rw-r--r--bundle-plugin-test/test-bundles/artifact-version-for-exports/src/main/java/ai/vespa/noversion/package-info.java5
-rw-r--r--bundle-plugin-test/test-bundles/main/pom.xml78
-rw-r--r--bundle-plugin-test/test-bundles/main/src/main/java/InDefaultPackage.java (renamed from bundle-plugin-test/src/main/java/InDefaultPackage.java)0
-rw-r--r--bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher.java (renamed from bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher.java)0
-rw-r--r--bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher2.java (renamed from bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher2.java)0
-rw-r--r--bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/package-info.java (renamed from bundle-plugin-test/src/main/java/com/yahoo/test/package-info.java)0
-rw-r--r--bundle-plugin-test/test-bundles/main/src/main/resources/configdefinitions/test.def (renamed from bundle-plugin-test/src/main/resources/configdefinitions/test.def)0
-rw-r--r--bundle-plugin-test/test-bundles/pom.xml75
17 files changed, 449 insertions, 98 deletions
diff --git a/bundle-plugin-test/integration-test/pom.xml b/bundle-plugin-test/integration-test/pom.xml
new file mode 100644
index 00000000000..42d3b0e4d62
--- /dev/null
+++ b/bundle-plugin-test/integration-test/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+<!-- Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<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>com.yahoo.vespa.bundle-plugin</groupId>
+ <artifactId>bundle-plugin-test</artifactId>
+ <version>7-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>integration-test</artifactId>
+ <version>7-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>config</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>vespajlib</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.yahoo.vespa.bundle-plugin</groupId>
+ <artifactId>main</artifactId>
+ <classifier>bundle</classifier>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.yahoo.vespa.bundle-plugin</groupId>
+ <artifactId>artifact-version-for-exports</artifactId>
+ <classifier>bundle</classifier>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <redirectTestOutputToFile>${test.hide}</redirectTestOutputToFile>
+ <systemPropertyVariables>
+ <test.bundle.path>${project.build.directory}/dependency</test.bundle.path>
+ </systemPropertyVariables>
+ <trimStackTrace>false</trimStackTrace>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeScope>compile</includeScope>
+ <excludeTransitive>true</excludeTransitive>
+ <stripVersion>true</stripVersion>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/bundle-plugin-test/src/test/java/com/yahoo/BundleIT.java b/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/BundleTest.java
index 932b78a5c8d..3c0379952fa 100644
--- a/bundle-plugin-test/src/test/java/com/yahoo/BundleIT.java
+++ b/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/BundleTest.java
@@ -1,16 +1,17 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo;
+package com.yahoo.container.plugin;
import com.yahoo.osgi.maven.ProjectBundleClassPaths;
import com.yahoo.vespa.config.VespaVersion;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
import java.io.File;
-import java.io.FilenameFilter;
import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.jar.Attributes;
@@ -19,6 +20,7 @@ import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
import static com.yahoo.osgi.maven.ProjectBundleClassPaths.CLASSPATH_MAPPINGS_FILENAME;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.containsString;
@@ -31,16 +33,19 @@ import static org.junit.Assert.assertThat;
/**
* Verifies the bundle jar file built and its manifest.
+ *
* @author Tony Vaagenes
*/
-public class BundleIT {
+public class BundleTest {
+ static final String TEST_BUNDLE_PATH = System.getProperty("test.bundle.path", ".") + "/";
+
private JarFile jarFile;
private Attributes mainAttributes;
@Before
public void setup() {
try {
- File componentJar = findBundleJar();
+ File componentJar = findBundleJar("main");
jarFile = new JarFile(componentJar);
Manifest manifest = jarFile.getManifest();
mainAttributes = manifest.getMainAttributes();
@@ -49,19 +54,13 @@ public class BundleIT {
}
}
- private File findBundleJar() {
- File[] componentFile = new File("target").listFiles(new FilenameFilter() {
- @Override
- public boolean accept(File file, String fileName) {
- return fileName.endsWith("-deploy.jar") || fileName.endsWith("-jar-with-dependencies.jar");
- }
- });
-
- if (componentFile.length != 1) {
- throw new RuntimeException("Failed finding component jar file");
+ static File findBundleJar(String bundleName) {
+ Path bundlePath = Paths.get(TEST_BUNDLE_PATH, bundleName + "-bundle.jar");
+ if (! Files.exists(bundlePath)) {
+ throw new RuntimeException("Failed finding component jar file: " + bundlePath);
}
- return componentFile[0];
+ return bundlePath.toFile();
}
@Test
@@ -75,7 +74,7 @@ public class BundleIT {
@Test
public void require_that_bundle_symbolic_name_matches_pom_artifactId() {
- assertThat(mainAttributes.getValue("Bundle-SymbolicName"), is("bundle-plugin-test"));
+ assertThat(mainAttributes.getValue("Bundle-SymbolicName"), is("main"));
}
@Test
@@ -141,17 +140,25 @@ public class BundleIT {
assertThat(webInfUrl, containsString("/WEB-INF/web.xml"));
}
+ // TODO Vespa 8: Remove, the classpath mappings file is only needed for jersey resources to work in the application test framework.
+ // When this test is removed, also remove the maven-resources-plugin from the 'main' test bundle's pom.
+ @Rule
+ public TemporaryFolder tempFolder = new TemporaryFolder();
@SuppressWarnings("unchecked")
@Test
- public void bundle_class_path_mappings_are_generated() throws URISyntaxException, IOException {
- URL mappingsUrl = getClass().getResource("/" + CLASSPATH_MAPPINGS_FILENAME);
+ public void bundle_class_path_mappings_are_generated() throws Exception {
+ ZipEntry classpathMappingsEntry = jarFile.getEntry(CLASSPATH_MAPPINGS_FILENAME);
+
assertNotNull(
- "Could not find " + CLASSPATH_MAPPINGS_FILENAME + " in the test output directory",
- mappingsUrl);
+ "Could not find " + CLASSPATH_MAPPINGS_FILENAME + " in the test bundle",
+ classpathMappingsEntry);
+
+ Path mappingsFile = tempFolder.newFile(CLASSPATH_MAPPINGS_FILENAME).toPath();
+ Files.copy(jarFile.getInputStream(classpathMappingsEntry), mappingsFile, REPLACE_EXISTING);
- ProjectBundleClassPaths bundleClassPaths = ProjectBundleClassPaths.load(Paths.get(mappingsUrl.toURI()));
+ ProjectBundleClassPaths bundleClassPaths = ProjectBundleClassPaths.load(mappingsFile);
- assertThat(bundleClassPaths.mainBundle.bundleSymbolicName, is("bundle-plugin-test"));
+ assertThat(bundleClassPaths.mainBundle.bundleSymbolicName, is("main"));
Collection<String> mainBundleClassPaths = bundleClassPaths.mainBundle.classPathElements;
diff --git a/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/ExportPackageVersionTest.java b/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/ExportPackageVersionTest.java
new file mode 100644
index 00000000000..66f36e32f39
--- /dev/null
+++ b/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/ExportPackageVersionTest.java
@@ -0,0 +1,72 @@
+// Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.container.plugin;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+
+import static com.yahoo.container.plugin.BundleTest.findBundleJar;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Verifies that the 'useArtifactVersionForExportPackages' setting for the bundle-plugin works as intended.
+ *
+ * @author gjoranv
+ */
+public class ExportPackageVersionTest {
+
+ private static Attributes mainAttributes;
+ private static String bundleVersion;
+
+ @BeforeClass
+ public static void setup() {
+ try {
+ File componentJar = findBundleJar("artifact-version-for-exports");
+ mainAttributes = new JarFile(componentJar).getManifest().getMainAttributes();
+ bundleVersion = mainAttributes.getValue("Bundle-Version");
+
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Test
+ public void artifact_version_without_qualifier_is_used_as_export_version() {
+ // Bundle-Version is artifact version without qualifier
+ String expectedExport = "ai.vespa.noversion;version=" + bundleVersion;
+
+ String exportPackage = mainAttributes.getValue("Export-Package");
+ assertThat(exportPackage, containsString(expectedExport));
+
+ // Verify that there is no qualifier
+ assertThat(exportPackage, not(containsString(expectedExport + ".")));
+ }
+
+ @Test
+ public void explicit_version_in_ExportPackage_annotation_overrides_artifact_version() {
+ String exportPackage = mainAttributes.getValue("Export-Package");
+ assertThat(exportPackage, containsString("ai.vespa.explicitversion;version=2.4.6.RELEASE"));
+ }
+
+ @Test
+ public void artifact_version_of_dependency_is_used_as_export_version_for_package_in_compile_scoped_dependency() {
+ String exportPackage = mainAttributes.getValue("Export-Package");
+
+ // TODO: This test should have checked for a fixed version of the dependency bundle, different than the main bundle version.
+ // See comment in the dependency bundle's pom.xml for why this is not the case.
+ assertThat(exportPackage, containsString("ai.vespa.noversion_dep;version=" + bundleVersion));
+ }
+
+ @Test
+ public void explicit_version_in_ExportPackage_annotation_overrides_artifact_version_of_compile_scoped_dependency() {
+ String exportPackage = mainAttributes.getValue("Export-Package");
+ assertThat(exportPackage, containsString("ai.vespa.explicitversion_dep;version=3.6.9.RELEASE"));
+ }
+
+}
diff --git a/bundle-plugin-test/pom.xml b/bundle-plugin-test/pom.xml
index 3ba9bf7b4b6..b27f6edc5f8 100644
--- a/bundle-plugin-test/pom.xml
+++ b/bundle-plugin-test/pom.xml
@@ -11,80 +11,12 @@
<version>7-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
- <groupId>com.yahoo.vespa</groupId>
+ <groupId>com.yahoo.vespa.bundle-plugin</groupId>
<artifactId>bundle-plugin-test</artifactId>
<version>7-SNAPSHOT</version>
- <packaging>container-plugin</packaging>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>container-dev</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>vespajlib</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>jrt</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <!-- Added to verify that module-info.class can be handled by bundle-plugin without throwing an exception. -->
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.3.0</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>bundle-plugin</artifactId>
- <version>${project.version}</version>
- <extensions>true</extensions>
- <configuration>
- <Import-Package>
- manualImport.withoutVersion,
- manualImport.withVersion;version="12.3.4",
- multiple.packages.with.the.same.version1;multiple.packages.with.the.same.version2;version="[1,2)"
- </Import-Package>
- <WebInfUrl>/WEB-INF/web.xml</WebInfUrl>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>2.9</version>
- <executions>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>integration-test</goal>
- </goals>
- </execution>
- <execution>
- <id>verify</id>
- <goals>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <packaging>pom</packaging>
+ <modules>
+ <module>integration-test</module>
+ <module>test-bundles</module>
+ </modules>
</project>
diff --git a/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/pom.xml b/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/pom.xml
new file mode 100644
index 00000000000..34b250ae927
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!-- Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<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>com.yahoo.vespa.bundle-plugin</groupId>
+ <artifactId>test-bundles</artifactId>
+ <version>7-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>artifact-version-for-exports-dep</artifactId>
+ <!-- TODO: Should use a fixed version different than the dependent bundle.
+ But version is set to the release version by build scripts before building.
+ Then, the dependent bundle will not find the artifact. Skipping this step for a sub-module seems
+ impossible with the maven-versions-plugin, and cumbersome with factorylib. -->
+ <version>7-SNAPSHOT</version>
+ <packaging>container-plugin</packaging>
+ <dependencies>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>bundle-plugin</artifactId>
+ <version>${project.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <useArtifactVersionForExportPackages>true</useArtifactVersionForExportPackages>
+ <configGenVersion>${project.version}</configGenVersion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/src/main/java/ai/vespa/explicitversion_dep/package-info.java b/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/src/main/java/ai/vespa/explicitversion_dep/package-info.java
new file mode 100644
index 00000000000..3eea8b11f1e
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/src/main/java/ai/vespa/explicitversion_dep/package-info.java
@@ -0,0 +1,6 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+@ExportPackage(version = @Version(major = 3, minor = 6, micro = 9, qualifier = "RELEASE"))
+package ai.vespa.explicitversion_dep;
+
+import com.yahoo.osgi.annotation.ExportPackage;
+import com.yahoo.osgi.annotation.Version;
diff --git a/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/src/main/java/ai/vespa/noversion_dep/package-info.java b/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/src/main/java/ai/vespa/noversion_dep/package-info.java
new file mode 100644
index 00000000000..794e177f7e7
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/src/main/java/ai/vespa/noversion_dep/package-info.java
@@ -0,0 +1,5 @@
+// Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+@ExportPackage
+package ai.vespa.noversion_dep;
+
+import com.yahoo.osgi.annotation.ExportPackage;
diff --git a/bundle-plugin-test/test-bundles/artifact-version-for-exports/pom.xml b/bundle-plugin-test/test-bundles/artifact-version-for-exports/pom.xml
new file mode 100644
index 00000000000..619189cd874
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/artifact-version-for-exports/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!-- Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<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>com.yahoo.vespa.bundle-plugin</groupId>
+ <artifactId>test-bundles</artifactId>
+ <version>7-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>artifact-version-for-exports</artifactId>
+ <version>7-SNAPSHOT</version>
+ <packaging>container-plugin</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>com.yahoo.vespa.bundle-plugin</groupId>
+ <artifactId>artifact-version-for-exports-dep</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <useArtifactVersionForExportPackages>true</useArtifactVersionForExportPackages>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/bundle-plugin-test/test-bundles/artifact-version-for-exports/src/main/java/ai/vespa/explicitversion/package-info.java b/bundle-plugin-test/test-bundles/artifact-version-for-exports/src/main/java/ai/vespa/explicitversion/package-info.java
new file mode 100644
index 00000000000..96cf6a3bf85
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/artifact-version-for-exports/src/main/java/ai/vespa/explicitversion/package-info.java
@@ -0,0 +1,6 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+@ExportPackage(version = @Version(major = 2, minor = 4, micro = 6, qualifier = "RELEASE"))
+package ai.vespa.explicitversion;
+
+import com.yahoo.osgi.annotation.ExportPackage;
+import com.yahoo.osgi.annotation.Version;
diff --git a/bundle-plugin-test/test-bundles/artifact-version-for-exports/src/main/java/ai/vespa/noversion/package-info.java b/bundle-plugin-test/test-bundles/artifact-version-for-exports/src/main/java/ai/vespa/noversion/package-info.java
new file mode 100644
index 00000000000..e7e11e39889
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/artifact-version-for-exports/src/main/java/ai/vespa/noversion/package-info.java
@@ -0,0 +1,5 @@
+// Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+@ExportPackage
+package ai.vespa.noversion;
+
+import com.yahoo.osgi.annotation.ExportPackage;
diff --git a/bundle-plugin-test/test-bundles/main/pom.xml b/bundle-plugin-test/test-bundles/main/pom.xml
new file mode 100644
index 00000000000..c9c9ea270eb
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/main/pom.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<!-- Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<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>com.yahoo.vespa.bundle-plugin</groupId>
+ <artifactId>test-bundles</artifactId>
+ <version>7-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>main</artifactId>
+ <version>7-SNAPSHOT</version>
+ <packaging>container-plugin</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>jrt</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <!-- Added to verify that module-info.class can be handled by bundle-plugin without throwing an exception. -->
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <Import-Package>
+ manualImport.withoutVersion,
+ manualImport.withVersion;version="12.3.4",
+ multiple.packages.with.the.same.version1;multiple.packages.with.the.same.version2;version="[1,2)"
+ </Import-Package>
+ <WebInfUrl>/WEB-INF/web.xml</WebInfUrl>
+ </configuration>
+ </plugin>
+ <plugin>
+ <!-- Trick to copy bundle-plugin.bundle-classpath-mappings.json from target/test-classes to target/classes -->
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-bundle-classpath-mappings-from-test-to-main</id>
+ <!-- NOTE: Must be done after generating classpath-mappings and before assembling the bundle (see the test-bundles pom) -->
+ <phase>process-test-sources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.outputDirectory}</outputDirectory>
+ <overwrite>true</overwrite>
+ <resources>
+ <resource>
+ <directory>${project.build.testOutputDirectory}</directory>
+ <includes>
+ <include>bundle-plugin.bundle-classpath-mappings.json</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/bundle-plugin-test/src/main/java/InDefaultPackage.java b/bundle-plugin-test/test-bundles/main/src/main/java/InDefaultPackage.java
index a650916d653..a650916d653 100644
--- a/bundle-plugin-test/src/main/java/InDefaultPackage.java
+++ b/bundle-plugin-test/test-bundles/main/src/main/java/InDefaultPackage.java
diff --git a/bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher.java b/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher.java
index dddca3f4d59..dddca3f4d59 100644
--- a/bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher.java
+++ b/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher.java
diff --git a/bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher2.java b/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher2.java
index 3220171de13..3220171de13 100644
--- a/bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher2.java
+++ b/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher2.java
diff --git a/bundle-plugin-test/src/main/java/com/yahoo/test/package-info.java b/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/package-info.java
index 5774fc8d5f2..5774fc8d5f2 100644
--- a/bundle-plugin-test/src/main/java/com/yahoo/test/package-info.java
+++ b/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/package-info.java
diff --git a/bundle-plugin-test/src/main/resources/configdefinitions/test.def b/bundle-plugin-test/test-bundles/main/src/main/resources/configdefinitions/test.def
index b4ba9ec518a..b4ba9ec518a 100644
--- a/bundle-plugin-test/src/main/resources/configdefinitions/test.def
+++ b/bundle-plugin-test/test-bundles/main/src/main/resources/configdefinitions/test.def
diff --git a/bundle-plugin-test/test-bundles/pom.xml b/bundle-plugin-test/test-bundles/pom.xml
new file mode 100644
index 00000000000..712ccb5542e
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/pom.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<!-- Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<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>com.yahoo.vespa.bundle-plugin</groupId>
+ <artifactId>bundle-plugin-test</artifactId>
+ <version>7-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>test-bundles</artifactId>
+ <version>7-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <!-- Trick to package bundles before test phase to allow running 'mvn test' -->
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>bundle-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>generate-classpath-mappings</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-bundle-classpath-mappings</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>package-test-bundles</id>
+ <!-- Must be done after generating classpath-mappings and copying it in the 'main' bundle. -->
+ <phase>test-compile</phase>
+ <goals>
+ <goal>generate-osgi-manifest</goal>
+ <goal>assemble-container-plugin</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <!-- Make the integration-test module use the bundle jars instead of the ordinary artifacts. -->
+ <AttachBundle>true</AttachBundle>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <modules>
+ <module>artifact-version-for-exports</module>
+ <module>artifact-version-for-exports-dep</module>
+ <module>main</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>container-dev</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <maven.javadoc.skip>true</maven.javadoc.skip>
+ </properties>
+</project>