This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/master by this push:
new 61166f0 [KARAF-6418] Flag to mark transitive dependencies with
dependency="true"
new fba58bf Merge pull request #937 from nantunes/bundle_dependency
61166f0 is described below
commit 61166f03ae5b7a27a7c87ffc45e3288c785703d1
Author: Nelson Antunes <[email protected]>
AuthorDate: Thu Sep 12 12:37:52 2019 +0100
[KARAF-6418] Flag to mark transitive dependencies with dependency="true"
---
.../it/test-transitive-as-dependency/control.xml | 28 ++++++++
.../src/it/test-transitive-as-dependency/pom.xml | 77 ++++++++++++++++++++++
.../transitive-as-dependency-feature/pom.xml | 69 +++++++++++++++++++
.../transitive-as-dependency-module-a/pom.xml | 58 ++++++++++++++++
.../src/main/java/test/A.java | 29 ++++++++
.../transitive-as-dependency-module-b/pom.xml | 59 +++++++++++++++++
.../src/main/java/test/B.java | 31 +++++++++
.../transitive-as-dependency-module-c/pom.xml | 59 +++++++++++++++++
.../src/main/java/test/C.java | 31 +++++++++
.../transitive-as-dependency-module-d/pom.xml | 54 +++++++++++++++
.../src/main/java/test/D.java | 25 +++++++
.../it/test-transitive-as-dependency/verify.bsh | 35 ++++++++++
.../tooling/features/GenerateDescriptorMojo.java | 21 +++++-
.../karaf/tooling/utils/Dependency31Helper.java | 11 ++--
.../karaf/tooling/utils/LocalDependency.java | 8 ++-
15 files changed, 589 insertions(+), 6 deletions(-)
diff --git
a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/control.xml
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/control.xml
new file mode 100644
index 0000000..6ea9be2
--- /dev/null
+++
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/control.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"
name="transitive-as-dependency-feature">
+ <feature name="transitive-as-dependency-feature"
description="transitive-as-dependency-feature" version="1.0.0.SNAPSHOT">
+
<bundle>mvn:test/transitive-as-dependency-module-a/1.0-SNAPSHOT</bundle>
+
<bundle>mvn:test/transitive-as-dependency-module-b/1.0-SNAPSHOT</bundle>
+ <bundle
dependency="true">mvn:test/transitive-as-dependency-module-c/1.0-SNAPSHOT</bundle>
+ <bundle
dependency="true">mvn:test/transitive-as-dependency-module-d/1.0-SNAPSHOT</bundle>
+ </feature>
+</features>
diff --git
a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/pom.xml
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/pom.xml
new file mode 100644
index 0000000..75c74d6
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/pom.xml
@@ -0,0 +1,77 @@
+<?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">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>test</groupId>
+ <artifactId>test-transitive-as-dependency</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <modules>
+ <module>transitive-as-dependency-module-a</module>
+ <module>transitive-as-dependency-module-b</module>
+ <module>transitive-as-dependency-module-c</module>
+ <module>transitive-as-dependency-module-d</module>
+ <module>transitive-as-dependency-feature</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <maxmem>256M</maxmem>
+ <fork>${compiler.fork}</fork>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <version>@pom.version@</version>
+ <executions>
+ <execution>
+ <id>generate-features-file</id>
+ <phase>package</phase>
+ <goals>
+ <goal>features-generate-descriptor</goal>
+ </goals>
+ <configuration>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git
a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-feature/pom.xml
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-feature/pom.xml
new file mode 100644
index 0000000..0d5f9ba
--- /dev/null
+++
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-feature/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>test</groupId>
+ <artifactId>test-transitive-as-dependency</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>test</groupId>
+ <artifactId>transitive-as-dependency-feature</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <packaging>feature</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>test</groupId>
+ <artifactId>transitive-as-dependency-module-a</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>test</groupId>
+ <artifactId>transitive-as-dependency-module-b</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <version>@pom.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <enableGeneration>true</enableGeneration>
+ <aggregateFeatures>false</aggregateFeatures>
+
<markTransitiveAsDependency>true</markTransitiveAsDependency>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-a/pom.xml
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-a/pom.xml
new file mode 100644
index 0000000..056db10
--- /dev/null
+++
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-a/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>test</groupId>
+ <artifactId>test-transitive-as-dependency</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>test</groupId>
+ <artifactId>transitive-as-dependency-module-a</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>test</groupId>
+ <artifactId>transitive-as-dependency-module-b</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.7</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-a/src/main/java/test/A.java
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-a/src/main/java/test/A.java
new file mode 100644
index 0000000..09f39ec
--- /dev/null
+++
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-a/src/main/java/test/A.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package test.a;
+
+import test.b.*;
+
+public class A
+{
+ public static String createStringWithDependencies() {
+ return "A-string " + B.BSTRING;
+ }
+}
diff --git
a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-b/pom.xml
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-b/pom.xml
new file mode 100644
index 0000000..3954a18
--- /dev/null
+++
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-b/pom.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>test</groupId>
+ <artifactId>test-transitive-as-dependency</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>test</groupId>
+ <artifactId>transitive-as-dependency-module-b</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <packaging>bundle</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>test</groupId>
+ <artifactId>transitive-as-dependency-module-c</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.7</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-b/src/main/java/test/B.java
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-b/src/main/java/test/B.java
new file mode 100644
index 0000000..3772ae2
--- /dev/null
+++
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-b/src/main/java/test/B.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package test.b;
+
+import test.c.*;
+
+public class B
+{
+ public static String BSTRING = "B-string";
+
+ public static String createStringWithDependencies() {
+ return BSTRING + " " + C.CSTRING;
+ }
+}
diff --git
a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-c/pom.xml
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-c/pom.xml
new file mode 100644
index 0000000..e81c81a
--- /dev/null
+++
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-c/pom.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>test</groupId>
+ <artifactId>test-transitive-as-dependency</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>test</groupId>
+ <artifactId>transitive-as-dependency-module-c</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <packaging>bundle</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>test</groupId>
+ <artifactId>transitive-as-dependency-module-d</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.7</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-c/src/main/java/test/C.java
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-c/src/main/java/test/C.java
new file mode 100644
index 0000000..e399efa
--- /dev/null
+++
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-c/src/main/java/test/C.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package test.c;
+
+import test.d.*;
+
+public class C
+{
+ public static String CSTRING = "C-string";
+
+ public static String createStringWithDependencies() {
+ return CSTRING + " " + D.DSTRING;
+ }
+}
diff --git
a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-d/pom.xml
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-d/pom.xml
new file mode 100644
index 0000000..7febe5e
--- /dev/null
+++
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-d/pom.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>test</groupId>
+ <artifactId>test-transitive-as-dependency</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>test</groupId>
+ <artifactId>transitive-as-dependency-module-d</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <packaging>bundle</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.7</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-d/src/main/java/test/D.java
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-d/src/main/java/test/D.java
new file mode 100644
index 0000000..27af619
--- /dev/null
+++
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/transitive-as-dependency-module-d/src/main/java/test/D.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package test.d;
+
+public class D
+{
+ public static String DSTRING = "D-string";
+}
diff --git
a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/verify.bsh
b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/verify.bsh
new file mode 100644
index 0000000..78e7571
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/verify.bsh
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.custommonkey.xmlunit.*;
+import java.io.*;
+import java.lang.*;
+
+Reader r = new FileReader(new File(basedir, "control.xml"));
+
+// load the features file pushed to the repository
+File generated = new File(basedir,
"transitive-as-dependency-feature/target/feature/feature.xml" );
+if (generated.exists()) {
+ try {
+ XMLAssert.assertXMLEqual(r, new FileReader(generated));
+ return true;
+ } catch (Throwable ignored) { }
+}
+
+return false;
diff --git
a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
index bfb0bb7..681abbd 100644
---
a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
+++
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
@@ -183,6 +183,20 @@ public class GenerateDescriptorMojo extends MojoSupport {
private boolean includeTransitiveDependency;
/**
+ * Flag indicating whether the plugin should mark transitive dependencies'
<code><bundle></code> elements as a dependency.
+ * This flag has only an effect when {@link #includeTransitiveDependency}
is <code>true</code>.
+ */
+ @Parameter(defaultValue = "false")
+ private boolean markTransitiveAsDependency;
+
+ /**
+ * Flag indicating whether the plugin should mark dependencies' in the
<code>runtime</code> scope <code><bundle></code> elements as a dependency.
+ * This flag has only an effect when {@link #includeTransitiveDependency}
is <code>true</code>.
+ */
+ @Parameter(defaultValue = "true")
+ private boolean markRuntimeScopeAsDependency;
+
+ /**
* The standard behavior is to add dependencies as
<code><bundle></code> elements to a <code><feature></code>
* with the same name as the artifactId of the project. This flag
disables that behavior.
* If this parameter is <code>true</code>, then two other parameters
refine the list of bundles added to the primary feature:
@@ -529,9 +543,14 @@ public class GenerateDescriptorMojo extends MojoSupport {
needWrap |= bundleNeedsWrapping;
}
}
- if ("runtime".equals(entry.getScope())) {
+
+ if (
+ (markRuntimeScopeAsDependency && "runtime".equals(
entry.getScope() )) ||
+ (markTransitiveAsDependency && entry.isTransitive())
+ ) {
bundle.setDependency(true);
}
+
if (startLevel != null && bundle.getStartLevel() == 0) {
bundle.setStartLevel(startLevel);
}
diff --git
a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/utils/Dependency31Helper.java
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/utils/Dependency31Helper.java
index 29c25d0..44bd3d0 100644
---
a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/utils/Dependency31Helper.java
+++
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/utils/Dependency31Helper.java
@@ -40,6 +40,7 @@ import
org.eclipse.aether.util.graph.selector.AndDependencySelector;
import org.eclipse.aether.util.graph.selector.ExclusionDependencySelector;
import org.eclipse.aether.util.graph.selector.OptionalDependencySelector;
import org.eclipse.aether.util.graph.transformer.*;
+import org.codehaus.plexus.util.StringUtils;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
@@ -219,14 +220,16 @@ public class Dependency31Helper implements
DependencyHelper {
public void scan(DependencyNode rootNode, boolean
useTransitiveDependencies) throws MojoExecutionException {
for (DependencyNode child : rootNode.getChildren()) {
- scan(rootNode, child, Accept.ACCEPT,
useTransitiveDependencies, false, "");
+ scan(rootNode, child, Accept.ACCEPT,
useTransitiveDependencies, false, 0);
}
if (useTransitiveDependencies) {
localDependencies.keySet().removeAll(dependencies);
}
}
- private void scan(DependencyNode parentNode, DependencyNode
dependencyNode, Accept parentAccept, boolean useTransitiveDependencies, boolean
isFromFeature, String indent) throws MojoExecutionException {
+ private void scan(DependencyNode parentNode, DependencyNode
dependencyNode, Accept parentAccept, boolean useTransitiveDependencies, boolean
isFromFeature, int transitiveLevel) throws MojoExecutionException {
+ String indent = StringUtils.repeat(" ", transitiveLevel);
+
Accept accept = accept(dependencyNode, parentAccept);
if (accept.isLocal()) {
if (isFromFeature) {
@@ -244,7 +247,7 @@ public class Dependency31Helper implements DependencyHelper
{
}
// TODO resolve scope conflicts
localDependencies.put(dependencyNode.getDependency().getArtifact(),
- new
LocalDependency(dependencyNode.getDependency().getScope(),
dependencyNode.getDependency().getArtifact(),
parentNode.getDependency().getArtifact()));
+ new
LocalDependency(dependencyNode.getDependency().getScope(), transitiveLevel > 0,
dependencyNode.getDependency().getArtifact(),
parentNode.getDependency().getArtifact()));
if (isFeature(dependencyNode) ||
!useTransitiveDependencies) {
isFromFeature = true;
}
@@ -252,7 +255,7 @@ public class Dependency31Helper implements DependencyHelper
{
if (useTransitiveDependencies && accept.isContinue()) {
List<DependencyNode> children =
dependencyNode.getChildren();
for (DependencyNode child : children) {
- scan(dependencyNode, child, accept,
useTransitiveDependencies, isFromFeature, indent + " ");
+ scan(dependencyNode, child, accept,
useTransitiveDependencies, isFromFeature, transitiveLevel + 1);
}
}
}
diff --git
a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/utils/LocalDependency.java
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/utils/LocalDependency.java
index a925ef1..58bd8c6 100644
---
a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/utils/LocalDependency.java
+++
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/utils/LocalDependency.java
@@ -20,11 +20,13 @@ import java.util.Objects;
public class LocalDependency {
private String scope;
+ private boolean isTransitive;
private Object artifact;
private Object parent;
- LocalDependency(final String scope, final Object artifact, Object
parent) {
+ LocalDependency(final String scope, final boolean isTransitive, final
Object artifact, Object parent) {
this.scope = scope;
+ this.isTransitive = isTransitive;
this.artifact = artifact;
this.parent = parent;
}
@@ -33,6 +35,10 @@ public class LocalDependency {
return scope;
}
+ public boolean isTransitive() {
+ return isTransitive;
+ }
+
public Object getArtifact() {
return artifact;
}