From: Stephen Kitt Date: Fri, 7 Apr 2017 15:28:40 +0000 (+0200) Subject: Drop karaf-maven-plugin X-Git-Tag: release/carbon~19 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F26%2F54526%2F1;p=odlparent.git Drop karaf-maven-plugin We can’t use it within odlparent anyway, and the release of Karaf 4.0.9 means we don’t need it. Change-Id: I04edebf6799115d35b225e145d18dc29235819a1 Signed-off-by: Stephen Kitt --- diff --git a/karaf/karaf-maven-plugin/NOTICE b/karaf/karaf-maven-plugin/NOTICE deleted file mode 100644 index 7ec727bc4..000000000 --- a/karaf/karaf-maven-plugin/NOTICE +++ /dev/null @@ -1,71 +0,0 @@ -Apache Karaf -Copyright 2010-2014 The Apache Software Foundation - - -I. Included Software - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). -Licensed under the Apache License 2.0. - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2010). -Licensed under the Apache License 2.0. - -This product includes software developed at -OW2 (http://www.ow2.org/). -Licensed under the BSD License. - -This product includes software developed at -OPS4J (http://www.ops4j.org/). -Licensed under the Apache License 2.0. - -This product includes software developed at -Eclipse Foundation (http://www.eclipse.org/). -Licensed under the EPL. - -This product includes software written by -Antony Lesuisse. -Licensed under Public Domain. - - -II. Used Software - -This product uses software developed at -FUSE Source (http://www.fusesource.org/). -Licensed under the Apache License 2.0. - -This product uses software developed at -AOP Alliance (http://aopalliance.sourceforge.net/). -Licensed under the Public Domain. - -This product uses software developed at -Tanuki Software (http://www.tanukisoftware.com/). -Licensed under the Apache License 2.0. - -This product uses software developed at -Jasypt (http://jasypt.sourceforge.net/). -Licensed under the Apache License 2.0. - -This product uses software developed at -JLine (http://jline.sourceforge.net). -Licensed under the BSD License. - -This product uses software developed at -SLF4J (http://www.slf4j.org/). -Licensed under the MIT License. - -This product uses software developed at -SpringSource (http://www.springsource.org/). -Licensed under the Apache License 2.0. - -This product includes software from http://www.json.org. -Copyright (c) 2002 JSON.org - - -III. License Summary -- Apache License 2.0 -- BSD License -- EPL License -- MIT License diff --git a/karaf/karaf-maven-plugin/pom.xml b/karaf/karaf-maven-plugin/pom.xml deleted file mode 100644 index 20dbb0b3c..000000000 --- a/karaf/karaf-maven-plugin/pom.xml +++ /dev/null @@ -1,293 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.karaf.tooling - tooling - 4.0.8 - - - - org.opendaylight.odlparent - karaf-maven-plugin - 4.0.9-SNAPSHOT - maven-plugin - Apache Karaf :: Tooling :: Maven Karaf Plugin - - - - org.apache.maven - maven-plugin-api - 3.0.3 - - - org.sonatype.aether - aether-api - 1.11 - - - org.sonatype.aether - aether-util - 1.11 - - - org.eclipse.aether - aether-api - 0.9.0.M2 - - - org.eclipse.aether - aether-util - 0.9.0.M2 - - - org.apache.maven - maven-artifact - 3.0.3 - - - org.apache.maven - maven-core - 3.0.3 - - - org.apache.maven - maven-compat - 3.0.3 - - - org.apache.maven.plugin-tools - maven-plugin-annotations - 3.3 - - - org.apache.maven.wagon - wagon-http - 2.10 - runtime - - - org.apache.karaf - org.apache.karaf.util - 4.0.8 - - - org.apache.karaf.jaas - org.apache.karaf.jaas.boot - - - - - org.apache.karaf.tooling - org.apache.karaf.tools.utils - 4.0.8 - - - org.apache.maven - maven-archiver - 2.5 - - - org.apache.maven.shared - maven-filtering - 1.0-beta-4 - - - org.codehaus.plexus - plexus-utils - 3.0 - - - org.apache.felix - org.apache.felix.fileinstall - - - org.apache.karaf.features - org.apache.karaf.features.core - 4.0.8 - - - org.apache.karaf.shell.console - org.apache.karaf.shell - - - - - org.apache.karaf.profile - org.apache.karaf.profile.core - 4.0.8 - - - org.apache.felix - org.apache.felix.resolver - - - org.ops4j.pax.url - pax-url-wrap - uber - - - org.ops4j.pax.url - pax-url-aether - - - org.apache.karaf.deployer - org.apache.karaf.deployer.kar - 4.0.8 - - - org.apache.karaf.kar - org.apache.karaf.kar.core - - - - - org.apache.karaf.kar - org.apache.karaf.kar.core - 4.0.8 - - - org.apache.karaf.shell - org.apache.karaf.shell.core - 4.0.8 - - - org.apache.karaf.jaas - org.apache.karaf.jaas.boot - - - - - org.apache.karaf - org.apache.karaf.main - 4.0.8 - - - commons-lang - commons-lang - 2.6 - - - org.apache.commons - commons-compress - - - org.osgi - org.osgi.core - compile - - - org.apache.xbean - xbean-finder-shaded - - - - - - true - - - - - - org.apache.maven.plugins - maven-invoker-plugin - 2.0.0 - - true - src/it - ${project.build.directory}/it - - */pom.xml - - verify - - - -Djava.io.tmpdir=${project.build.directory} - ${invoker.skip} - ${invoker.skip} - - package - - - - - integration-test - - install - run - - - - test-offline - - run - - - src/test/offline.properties - - test-check-dependencies-failure/pom.xml - - - - - - - xmlunit - xmlunit - 1.3 - - - - - maven-plugin-plugin - - - default-descriptor - - descriptor - - process-classes - - - - - maven-site-plugin - - true - - - - - - - - - - - maven-plugin-plugin - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-features/pom.xml b/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-features/pom.xml deleted file mode 100644 index e46bb4f22..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-features/pom.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - 4.0.0 - - test - test-aggregate-features - 1.0-SNAPSHOT - ../pom.xml - - - test - aggregate-features - 1.0-SNAPSHOT - - feature - - - UTF-8 - - - - - test - aggregate-recursive-module-a - 1.0-SNAPSHOT - xml - features - - - test - aggregate-recursive-module-b - 1.0-SNAPSHOT - xml - features - - - test - aggregate-recursive-module-c - 1.0-SNAPSHOT - xml - features - - - test - aggregate-recursive-module-d - 1.0-SNAPSHOT - xml - features - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - generate-features-file - package - - features-generate-descriptor - - - true - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-a/pom.xml b/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-a/pom.xml deleted file mode 100644 index 7be589087..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-a/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - 4.0.0 - - test - test-aggregate-features - 1.0-SNAPSHOT - ../pom.xml - - - test - aggregate-recursive-module-a - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-a/src/main/java/test/A.java b/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-a/src/main/java/test/A.java deleted file mode 100644 index 9aa5496e8..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-a/src/main/java/test/A.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.a; - -public class A -{ - public static String ASTRING = "A-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-b/pom.xml b/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-b/pom.xml deleted file mode 100644 index 4f8ae9625..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-b/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - 4.0.0 - - test - test-aggregate-features - 1.0-SNAPSHOT - ../pom.xml - - - test - aggregate-recursive-module-b - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-b/src/main/java/test/B.java b/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-b/src/main/java/test/B.java deleted file mode 100644 index b66ddeafe..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-b/src/main/java/test/B.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.b; - -public class B -{ - public static String BSTRING = "B-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-c/pom.xml b/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-c/pom.xml deleted file mode 100644 index 3e4f8deee..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-c/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - 4.0.0 - - test - test-aggregate-features - 1.0-SNAPSHOT - ../pom.xml - - - test - aggregate-recursive-module-c - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - test - aggregate-recursive-module-b - 1.0-SNAPSHOT - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-c/src/main/java/test/C.java b/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-c/src/main/java/test/C.java deleted file mode 100644 index 423006cdb..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-c/src/main/java/test/C.java +++ /dev/null @@ -1,29 +0,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. - */ - -package test.c; - -import test.b.*; - -public class C -{ - public static String createStringWithDependencies() { - return B.BSTRING + " " + "C-string"; - } -} diff --git a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-d/pom.xml b/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-d/pom.xml deleted file mode 100644 index aab71cc64..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-d/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - 4.0.0 - - test - test-aggregate-features - 1.0-SNAPSHOT - ../pom.xml - - - test - aggregate-recursive-module-d - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - test - aggregate-recursive-module-a - 1.0-SNAPSHOT - - - test - aggregate-recursive-module-c - 1.0-SNAPSHOT - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-d/src/main/java/test/D.java b/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-d/src/main/java/test/D.java deleted file mode 100644 index 6d8723287..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/aggregate-recursive-module-d/src/main/java/test/D.java +++ /dev/null @@ -1,30 +0,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. - */ - -package test.d; - -import test.a.*; -import test.c.*; - -public class D -{ - public String createStringWithDependencies() { - return A.ASTRING + " " + C.createStringWithDependencies() + " " + "D-string"; - } -} diff --git a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/control.xml b/karaf/karaf-maven-plugin/src/it/test-aggregate-features/control.xml deleted file mode 100644 index 81e1844a9..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/control.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - -
Test Description
- mvn:test/aggregate-recursive-module-b/1.0-SNAPSHOT -
- -
Test Description
- mvn:test/aggregate-recursive-module-a/1.0-SNAPSHOT - mvn:test/aggregate-recursive-module-c/1.0-SNAPSHOT - mvn:test/aggregate-recursive-module-b/1.0-SNAPSHOT -
- -
Test Description
- aggregate-recursive-module-c - aggregate-recursive-module-d -
-
diff --git a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/pom.xml b/karaf/karaf-maven-plugin/src/it/test-aggregate-features/pom.xml deleted file mode 100644 index 8e6b26ada..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - 4.0.0 - - test - test-aggregate-features - 1.0-SNAPSHOT - - pom - - Test Description - - - UTF-8 - - - - aggregate-recursive-module-a - aggregate-recursive-module-b - aggregate-recursive-module-c - aggregate-recursive-module-d - aggregate-features - - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - package - - features-generate-descriptor - - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-aggregate-features/verify.bsh deleted file mode 100644 index 38c7ae15c..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-aggregate-features/verify.bsh +++ /dev/null @@ -1,34 +0,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. - */ - -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, "aggregate-features/target/feature/feature.xml"); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} -return false; diff --git a/karaf/karaf-maven-plugin/src/it/test-assembly-prop-edits/pom.xml b/karaf/karaf-maven-plugin/src/it/test-assembly-prop-edits/pom.xml deleted file mode 100644 index 0c8653b5a..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-assembly-prop-edits/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - 4.0.0 - - test - test-assembl-prop-edits - 1.0-SNAPSHOT - karaf-assembly - - - UTF-8 - - - - org.apache.karaf.features - framework - 4.0.1 - kar - - - org.apache.karaf.features - standard - 4.0.1 - features - xml - runtime - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - ${project.artifactId} - - bundle - config - diagnostic - feature - jaas - shell - log - management - package - shell-compat - ssh - system - wrap - - false - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-assembly-prop-edits/src/main/karaf/assembly-property-edits.xml b/karaf/karaf-maven-plugin/src/it/test-assembly-prop-edits/src/main/karaf/assembly-property-edits.xml deleted file mode 100644 index eb3cd27f1..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-assembly-prop-edits/src/main/karaf/assembly-property-edits.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - config.properties - put - karaf.framework - equinox - - - config.properties - extend - org.osgi.framework.system.capabilities - my-magic-capability - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-assembly-prop-edits/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-assembly-prop-edits/verify.bsh deleted file mode 100644 index e256f34e0..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-assembly-prop-edits/verify.bsh +++ /dev/null @@ -1,29 +0,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. - */ - -import java.io.*; -import java.lang.*; -import java.util.*; - -Properties props = new Properties(); -InputStream propStream = new FileInputStream(new File(basedir, "target/assembly/etc/config.properties")); -props.load(propStream); -return "equinox".equals(props.getProperty("karaf.framework")); - - diff --git a/karaf/karaf-maven-plugin/src/it/test-assembly/pom.xml b/karaf/karaf-maven-plugin/src/it/test-assembly/pom.xml deleted file mode 100644 index 50907ba8b..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-assembly/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - 4.0.0 - - test - test-basic-generation - 1.0-SNAPSHOT - karaf-assembly - - - UTF-8 - - - - org.apache.karaf.features - framework - 4.0.3 - kar - - - org.apache.karaf.features - standard - 4.0.3 - features - xml - runtime - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - ${project.artifactId} - - bundle - config - diagnostic - feature - jaas - shell - log - management - package - shell-compat - ssh - system - wrap - - false - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-basic-generation/control.xml b/karaf/karaf-maven-plugin/src/it/test-basic-generation/control.xml deleted file mode 100644 index 1d4ca2a1c..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-basic-generation/control.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-basic-generation/pom.xml b/karaf/karaf-maven-plugin/src/it/test-basic-generation/pom.xml deleted file mode 100644 index 0590a3f02..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-basic-generation/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - 4.0.0 - - test - test-basic-generation - 1.0-SNAPSHOT - bundle - - - UTF-8 - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - package - - features-generate-descriptor - - - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-basic-generation/src/main/java/test/App.java b/karaf/karaf-maven-plugin/src/it/test-basic-generation/src/main/java/test/App.java deleted file mode 100644 index fedb5dab2..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-basic-generation/src/main/java/test/App.java +++ /dev/null @@ -1,32 +0,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. - */ - -package test; - -/** - * Hello world! - * - */ -public class App -{ - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } -} diff --git a/karaf/karaf-maven-plugin/src/it/test-basic-generation/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-basic-generation/verify.bsh deleted file mode 100644 index 6af1a7c85..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-basic-generation/verify.bsh +++ /dev/null @@ -1,35 +0,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. - */ - -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, "target/feature/feature.xml" ); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} - -return false; diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/control.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/control.xml deleted file mode 100644 index 9e7ef4e67..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/control.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - mvn:test/dependency-module-a/1.0-SNAPSHOT - mvn:test/dependency-module-b/1.0-SNAPSHOT - - - mvn:test/dependency-module-c/1.0-SNAPSHOT - mvn:test/dependency-module-a/1.0-SNAPSHOT - mvn:test/dependency-module-b/1.0-SNAPSHOT - - - dependency-module-c - dependency-module-d - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependencies-features/invoker.properties b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependencies-features/invoker.properties deleted file mode 100644 index e2abb3d81..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependencies-features/invoker.properties +++ /dev/null @@ -1,20 +0,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. -# - -invoker.buildResult = failure diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependencies-features/pom.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependencies-features/pom.xml deleted file mode 100644 index 288567745..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependencies-features/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - 4.0.0 - - test - test-check-dependencies-failure - 1.0-SNAPSHOT - ../pom.xml - - - test - check-dependencies-features - 1.0-SNAPSHOT - - feature - - - UTF-8 - - - - - test - dependency-module-a - 1.0-SNAPSHOT - xml - features - - - test - dependency-module-b - 1.0-SNAPSHOT - xml - features - - - test - dependency-module-c - 1.0-SNAPSHOT - xml - features - - - test - dependency-module-d - 1.0-SNAPSHOT - xml - features - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - generate-features-file - package - - features-generate-descriptor - - - true - true - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependencies-features/src/main/history/dependencies.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependencies-features/src/main/history/dependencies.xml deleted file mode 100644 index e033398f6..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependencies-features/src/main/history/dependencies.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - mvn:test/dependency-module-a/1.0-SNAPSHOT - mvn:test/dependency-module-b/1.0-SNAPSHOT - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-a/pom.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-a/pom.xml deleted file mode 100644 index d2350dc95..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-a/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - 4.0.0 - - test - test-check-dependencies-failure - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-module-a - 1.0-SNAPSHOT - bundle - - - UTF-8 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-a/src/main/java/test/A.java b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-a/src/main/java/test/A.java deleted file mode 100644 index 9aa5496e8..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-a/src/main/java/test/A.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.a; - -public class A -{ - public static String ASTRING = "A-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-b/pom.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-b/pom.xml deleted file mode 100644 index 8aa7bd5d1..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-b/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - 4.0.0 - - test - test-check-dependencies-failure - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-module-b - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-b/src/main/java/test/B.java b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-b/src/main/java/test/B.java deleted file mode 100644 index b66ddeafe..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-b/src/main/java/test/B.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.b; - -public class B -{ - public static String BSTRING = "B-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-c/pom.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-c/pom.xml deleted file mode 100644 index c393257d0..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-c/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - 4.0.0 - - test - test-check-dependencies-failure - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-module-c - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - test - dependency-module-a - 1.0-SNAPSHOT - - - test - dependency-module-b - 1.0-SNAPSHOT - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-c/src/main/java/test/C.java b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-c/src/main/java/test/C.java deleted file mode 100644 index 630440f90..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-c/src/main/java/test/C.java +++ /dev/null @@ -1,30 +0,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. - */ - -package test.c; - -import test.a.*; -import test.b.*; - -public class C -{ - public static String createStringWithDependencies() { - return A.ASTRING + " " + B.BSTRING + " " + "C-string"; - } -} diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-d/pom.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-d/pom.xml deleted file mode 100644 index b7285d908..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-d/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - 4.0.0 - - test - test-check-dependencies-failure - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-module-d - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - test - dependency-module-c - 1.0-SNAPSHOT - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-d/src/main/java/test/D.java b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-d/src/main/java/test/D.java deleted file mode 100644 index 370fad8a6..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/dependency-module-d/src/main/java/test/D.java +++ /dev/null @@ -1,29 +0,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. - */ - -package test.d; - -import test.c.*; - -public class D -{ - public String createStringWithDependencies() { - return C.createStringWithDependencies() + " " + "D-string"; - } -} diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/invoker.properties b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/invoker.properties deleted file mode 100644 index e2abb3d81..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/invoker.properties +++ /dev/null @@ -1,20 +0,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. -# - -invoker.buildResult = failure diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/pom.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/pom.xml deleted file mode 100644 index 780280788..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - 4.0.0 - test - test-check-dependencies-failure - 1.0-SNAPSHOT - pom - - - UTF-8 - - - - dependency-module-a - dependency-module-b - dependency-module-c - dependency-module-d - dependencies-features - - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - package - - features-generate-descriptor - - - - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/verify.bsh deleted file mode 100644 index c5515354e..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies-failure/verify.bsh +++ /dev/null @@ -1,35 +0,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. - */ - -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, "dependencies-features/target/feature/feature.xml" ); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} - -return false; diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/control.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies/control.xml deleted file mode 100644 index 9e7ef4e67..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/control.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - mvn:test/dependency-module-a/1.0-SNAPSHOT - mvn:test/dependency-module-b/1.0-SNAPSHOT - - - mvn:test/dependency-module-c/1.0-SNAPSHOT - mvn:test/dependency-module-a/1.0-SNAPSHOT - mvn:test/dependency-module-b/1.0-SNAPSHOT - - - dependency-module-c - dependency-module-d - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependencies-features/pom.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependencies-features/pom.xml deleted file mode 100644 index d6f85066a..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependencies-features/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - 4.0.0 - - test - test-check-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - check-dependencies-features - 1.0-SNAPSHOT - - feature - - - UTF-8 - - - - - test - dependency-module-a - 1.0-SNAPSHOT - xml - features - - - test - dependency-module-b - 1.0-SNAPSHOT - xml - features - - - test - dependency-module-c - 1.0-SNAPSHOT - xml - features - - - test - dependency-module-d - 1.0-SNAPSHOT - xml - features - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - generate-features-file - package - - features-generate-descriptor - - - true - true - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-a/pom.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-a/pom.xml deleted file mode 100644 index 19aa7074b..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-a/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - 4.0.0 - - test - test-check-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-module-a - 1.0-SNAPSHOT - bundle - - - UTF-8 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-a/src/main/java/test/A.java b/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-a/src/main/java/test/A.java deleted file mode 100644 index 9aa5496e8..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-a/src/main/java/test/A.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.a; - -public class A -{ - public static String ASTRING = "A-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-b/pom.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-b/pom.xml deleted file mode 100644 index 65018c7d9..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-b/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - 4.0.0 - - test - test-check-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-module-b - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-b/src/main/java/test/B.java b/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-b/src/main/java/test/B.java deleted file mode 100644 index b66ddeafe..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-b/src/main/java/test/B.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.b; - -public class B -{ - public static String BSTRING = "B-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-c/pom.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-c/pom.xml deleted file mode 100644 index 8bf290de6..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-c/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - 4.0.0 - - test - test-check-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-module-c - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - test - dependency-module-a - 1.0-SNAPSHOT - - - test - dependency-module-b - 1.0-SNAPSHOT - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-c/src/main/java/test/C.java b/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-c/src/main/java/test/C.java deleted file mode 100644 index 630440f90..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-c/src/main/java/test/C.java +++ /dev/null @@ -1,30 +0,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. - */ - -package test.c; - -import test.a.*; -import test.b.*; - -public class C -{ - public static String createStringWithDependencies() { - return A.ASTRING + " " + B.BSTRING + " " + "C-string"; - } -} diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-d/pom.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-d/pom.xml deleted file mode 100644 index 1b3d30372..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-d/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - 4.0.0 - - test - test-check-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-module-d - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - test - dependency-module-c - 1.0-SNAPSHOT - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-d/src/main/java/test/D.java b/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-d/src/main/java/test/D.java deleted file mode 100644 index 370fad8a6..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/dependency-module-d/src/main/java/test/D.java +++ /dev/null @@ -1,29 +0,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. - */ - -package test.d; - -import test.c.*; - -public class D -{ - public String createStringWithDependencies() { - return C.createStringWithDependencies() + " " + "D-string"; - } -} diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/pom.xml b/karaf/karaf-maven-plugin/src/it/test-check-dependencies/pom.xml deleted file mode 100644 index 6c1f2f075..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - 4.0.0 - - test - test-check-dependencies - 1.0-SNAPSHOT - pom - - - UTF-8 - - - - dependency-module-a - dependency-module-b - dependency-module-c - dependency-module-d - dependencies-features - - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - package - - features-generate-descriptor - - - - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-check-dependencies/verify.bsh deleted file mode 100644 index c5515354e..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-check-dependencies/verify.bsh +++ /dev/null @@ -1,35 +0,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. - */ - -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, "dependencies-features/target/feature/feature.xml" ); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} - -return false; diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/control.xml b/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/control.xml deleted file mode 100644 index d0f9b53bf..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/control.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - dependency-feature-c - mvn:test/dependency-bundle-a/1.0-SNAPSHOT - mvn:test/dependency-bundle-b/1.0-SNAPSHOT - - - mvn:test/dependency-bundle-c/1.0-SNAPSHOT - - - dependency-feature-a - dependency-feature-c - - diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependencies-features/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependencies-features/pom.xml deleted file mode 100644 index 3b232ab32..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependencies-features/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - 4.0.0 - - test - test-feature-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependencies-features - 1.0-SNAPSHOT - - feature - - - UTF-8 - - - - - test - dependency-feature-a - 1.0-SNAPSHOT - features - xml - - - test - dependency-feature-c - 1.0-SNAPSHOT - features - xml - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - generate-features-file - package - - features-generate-descriptor - - - true - true - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-a/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-a/pom.xml deleted file mode 100644 index 4498f53b2..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-a/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - 4.0.0 - - test - test-feature-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-bundle-a - 1.0-SNAPSHOT - bundle - - - UTF-8 - - - - - test - dependency-bundle-b - ${project.version} - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-a/src/main/java/test/A.java b/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-a/src/main/java/test/A.java deleted file mode 100644 index 9aa5496e8..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-a/src/main/java/test/A.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.a; - -public class A -{ - public static String ASTRING = "A-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-b/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-b/pom.xml deleted file mode 100644 index b1c465cd0..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-b/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - 4.0.0 - - test - test-feature-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-bundle-b - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - test - dependency-feature-c - ${project.version} - features - xml - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-b/src/main/java/test/B.java b/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-b/src/main/java/test/B.java deleted file mode 100644 index b66ddeafe..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-b/src/main/java/test/B.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.b; - -public class B -{ - public static String BSTRING = "B-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-c/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-c/pom.xml deleted file mode 100644 index 797b1e4d5..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-c/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - 4.0.0 - - test - test-feature-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-bundle-c - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-c/src/main/java/test/C.java b/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-c/src/main/java/test/C.java deleted file mode 100644 index ad36cd80d..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-bundle-c/src/main/java/test/C.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.c; - -public class C -{ - public static String CSTRING = "C-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-feature-a/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-feature-a/pom.xml deleted file mode 100644 index d11c7ee7a..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-feature-a/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - 4.0.0 - - test - test-feature-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-feature-a - 1.0-SNAPSHOT - feature - - - UTF-8 - - - - - test - dependency-bundle-a - ${project.version} - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - generate-features-file - package - - features-generate-descriptor - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-feature-c/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-feature-c/pom.xml deleted file mode 100644 index 671745087..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/dependency-feature-c/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - 4.0.0 - - test - test-feature-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-feature-c - 1.0-SNAPSHOT - feature - - - UTF-8 - - - - - test - dependency-bundle-c - ${project.version} - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - generate-features-file - package - - features-generate-descriptor - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/pom.xml deleted file mode 100644 index 143f0c729..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - 4.0.0 - - test - test-feature-dependencies - 1.0-SNAPSHOT - pom - - - UTF-8 - - - - - - dependency-feature-a - dependency-bundle-a - dependency-bundle-b - dependency-feature-c - dependency-bundle-c - dependencies-features - - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - package - - features-generate-descriptor - - - - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/verify.bsh deleted file mode 100644 index c5515354e..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-dependencies/verify.bsh +++ /dev/null @@ -1,35 +0,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. - */ - -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, "dependencies-features/target/feature/feature.xml" ); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} - -return false; diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-base-version/control.xml b/karaf/karaf-maven-plugin/src/it/test-feature-use-base-version/control.xml deleted file mode 100644 index 60e46d620..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-base-version/control.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - mvn:org.apache.commons/commons-lang3/3.4 - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-base-version/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-use-base-version/pom.xml deleted file mode 100644 index c8b8dc91d..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-base-version/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - 4.0.0 - - test - test-feature-use-base-version - 1.0-SNAPSHOT - feature - - - - org.apache.commons - commons-lang3 - 3.4 - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-base-version/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-feature-use-base-version/verify.bsh deleted file mode 100644 index 6af1a7c85..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-base-version/verify.bsh +++ /dev/null @@ -1,35 +0,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. - */ - -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, "target/feature/feature.xml" ); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} - -return false; diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/control.xml b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/control.xml deleted file mode 100644 index 131f23fbc..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/control.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - mvn:test/transitive/[0.9,1.9) - mvn:org.apache.commons/commons-lang3/[3.0,3.4) - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/feature/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/feature/pom.xml deleted file mode 100644 index f6d3f1e25..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/feature/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - 4.0.0 - - test - feature - 1.0-SNAPSHOT - feature - - - - test - transitive - [0.9,1.9) - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - true - true - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/pom.xml deleted file mode 100644 index 117cd737c..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - 4.0.0 - - test - test-feature-use-version-range-transfer-properties - 1.0-SNAPSHOT - pom - - - transitive - feature - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/transitive/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/transitive/pom.xml deleted file mode 100644 index 37c244309..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/transitive/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - 4.0.0 - - test - transitive - 1.0-SNAPSHOT - bundle - - - - org.apache.commons - commons-lang3 - [3.0,3.4) - - - - - - - 1.8 - - - - - true - org.apache.felix - maven-bundle-plugin - 3.0.1 - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/verify.bsh deleted file mode 100644 index 140050291..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/verify.bsh +++ /dev/null @@ -1,35 +0,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. - */ - -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, "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/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/control.xml b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/control.xml deleted file mode 100644 index 131f23fbc..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/control.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - mvn:test/transitive/[0.9,1.9) - mvn:org.apache.commons/commons-lang3/[3.0,3.4) - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/feature/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/feature/pom.xml deleted file mode 100644 index f6d3f1e25..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/feature/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - 4.0.0 - - test - feature - 1.0-SNAPSHOT - feature - - - - test - transitive - [0.9,1.9) - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - true - true - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/pom.xml deleted file mode 100644 index 20808ac72..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - 4.0.0 - - test - test-feature-use-version-range-transitive - 1.0-SNAPSHOT - pom - - - transitive - feature - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/transitive/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/transitive/pom.xml deleted file mode 100644 index 95a0da476..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/transitive/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - 4.0.0 - - test - transitive - 1.0-SNAPSHOT - bundle - - - - org.apache.commons - commons-lang3 - [3.0,3.4) - - - - - - - true - org.apache.felix - maven-bundle-plugin - 3.0.1 - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/verify.bsh deleted file mode 100644 index 140050291..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/verify.bsh +++ /dev/null @@ -1,35 +0,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. - */ - -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, "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/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range/control.xml b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range/control.xml deleted file mode 100644 index a29d8c8a3..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range/control.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - mvn:org.apache.commons/commons-lang3/[3.0,3.4) - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range/pom.xml b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range/pom.xml deleted file mode 100644 index 2c60d55ba..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - 4.0.0 - - test - test-feature-use-version-range - 1.0-SNAPSHOT - feature - - - - org.apache.commons - commons-lang3 - [3.0,3.4) - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - true - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range/verify.bsh deleted file mode 100644 index 6af1a7c85..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-feature-use-version-range/verify.bsh +++ /dev/null @@ -1,35 +0,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. - */ - -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, "target/feature/feature.xml" ); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} - -return false; diff --git a/karaf/karaf-maven-plugin/src/it/test-include-project-artifact/control.xml b/karaf/karaf-maven-plugin/src/it/test-include-project-artifact/control.xml deleted file mode 100644 index caf596044..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-include-project-artifact/control.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - mvn:test/test-include-project-artifact/1.0-SNAPSHOT - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-include-project-artifact/pom.xml b/karaf/karaf-maven-plugin/src/it/test-include-project-artifact/pom.xml deleted file mode 100644 index 976e5c188..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-include-project-artifact/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - 4.0.0 - - test - test-include-project-artifact - 1.0-SNAPSHOT - bundle - - - UTF-8 - - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - package - - features-generate-descriptor - - - true - - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-include-project-artifact/src/main/java/test/App.java b/karaf/karaf-maven-plugin/src/it/test-include-project-artifact/src/main/java/test/App.java deleted file mode 100644 index c95d24593..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-include-project-artifact/src/main/java/test/App.java +++ /dev/null @@ -1,30 +0,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. - */ -package test; - -/** - * Hello world! - */ -public class App { - - public static void main( String[] args ) { - System.out.println( "Hello World!" ); - } - -} diff --git a/karaf/karaf-maven-plugin/src/it/test-include-project-artifact/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-include-project-artifact/verify.bsh deleted file mode 100644 index 6af1a7c85..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-include-project-artifact/verify.bsh +++ /dev/null @@ -1,35 +0,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. - */ - -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, "target/feature/feature.xml" ); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} - -return false; diff --git a/karaf/karaf-maven-plugin/src/it/test-input-file/control.xml b/karaf/karaf-maven-plugin/src/it/test-input-file/control.xml deleted file mode 100644 index b881b51a6..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-input-file/control.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - -
Test Description
- mvn:test/test-input-file/1.0-SNAPSHOT -
-
diff --git a/karaf/karaf-maven-plugin/src/it/test-input-file/pom.xml b/karaf/karaf-maven-plugin/src/it/test-input-file/pom.xml deleted file mode 100644 index f8af64a69..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-input-file/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - 4.0.0 - - test - test-input-file - 1.0-SNAPSHOT - bundle - Test Description - - - UTF-8 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - package - - features-generate-descriptor - - - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-input-file/src/main/feature/feature.xml b/karaf/karaf-maven-plugin/src/it/test-input-file/src/main/feature/feature.xml deleted file mode 100644 index b51748d91..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-input-file/src/main/feature/feature.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - mvn:${project.groupId}/${project.artifactId}/${project.version} - - diff --git a/karaf/karaf-maven-plugin/src/it/test-input-file/src/main/java/test/App.java b/karaf/karaf-maven-plugin/src/it/test-input-file/src/main/java/test/App.java deleted file mode 100644 index fedb5dab2..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-input-file/src/main/java/test/App.java +++ /dev/null @@ -1,32 +0,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. - */ - -package test; - -/** - * Hello world! - * - */ -public class App -{ - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } -} diff --git a/karaf/karaf-maven-plugin/src/it/test-input-file/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-input-file/verify.bsh deleted file mode 100644 index 6af1a7c85..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-input-file/verify.bsh +++ /dev/null @@ -1,35 +0,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. - */ - -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, "target/feature/feature.xml" ); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} - -return false; diff --git a/karaf/karaf-maven-plugin/src/it/test-kar-classifier/pom.xml b/karaf/karaf-maven-plugin/src/it/test-kar-classifier/pom.xml deleted file mode 100644 index cea616ca9..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-kar-classifier/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - 4.0.0 - - test - test-kar-classifier - 1.0-SNAPSHOT - pom - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - - features-generate-descriptor - - - - kar - - kar - - - classy - - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-kar-classifier/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-kar-classifier/verify.bsh deleted file mode 100644 index 841f65a53..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-kar-classifier/verify.bsh +++ /dev/null @@ -1,29 +0,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. - */ - -import java.io.*; -import java.lang.*; - -// check that the kar archive has been pushed to the repository -File generated = new File(basedir, "target/test-kar-classifier-1.0-SNAPSHOT-classy.kar"); -if (generated.exists()) { - return true; -} - -return false; \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-kar-multiple-kars/pom.xml b/karaf/karaf-maven-plugin/src/it/test-kar-multiple-kars/pom.xml deleted file mode 100644 index 58626d5fe..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-kar-multiple-kars/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - 4.0.0 - - test - test-kar-multiple-kars - 1.0-SNAPSHOT - pom - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file1 - - features-generate-descriptor - - - feature1 - ${project.build.directory}/feature/feature1.xml - - - - generate-features-file2 - - features-generate-descriptor - - - feature2 - ${project.build.directory}/feature/feature2.xml - - - - - kar1 - - kar - - - kar1 - ${project.build.directory}/feature/feature1.xml - - - - kar2 - - kar - - - kar2 - ${project.build.directory}/feature/feature2.xml - - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-kar-multiple-kars/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-kar-multiple-kars/verify.bsh deleted file mode 100644 index 13584fb9a..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-kar-multiple-kars/verify.bsh +++ /dev/null @@ -1,34 +0,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. - */ - -import java.io.*; -import java.lang.*; - -// check if the kar archives and features XMLs have been pushed to the repository -File feature1 = new File(basedir, "target/feature/feature1.xml"); -File feature2 = new File(basedir, "target/feature/feature2.xml"); - -File kar1 = new File(basedir, "target/test-kar-multiple-kars-1.0-SNAPSHOT-kar1.kar"); -File kar2 = new File(basedir, "target/test-kar-multiple-kars-1.0-SNAPSHOT-kar2.kar"); - -if (feature1.exists() && feature2.exists() && kar1.exists() && kar2.exists()) { - return true; -} - -return false; \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-kar-packaging/pom.xml b/karaf/karaf-maven-plugin/src/it/test-kar-packaging/pom.xml deleted file mode 100644 index ce2c53ade..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-kar-packaging/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - 4.0.0 - - test - test-kar-packaging - 1.0-SNAPSHOT - kar - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-kar-packaging/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-kar-packaging/verify.bsh deleted file mode 100644 index 5de530cbc..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-kar-packaging/verify.bsh +++ /dev/null @@ -1,29 +0,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. - */ - -import java.io.*; -import java.lang.*; - -// check if the kar archive has been pushed to the repository -File generated = new File(basedir, "target/test-kar-packaging-1.0-SNAPSHOT.kar"); -if (generated.exists()) { - return true; -} - -return false; \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-kar-with-pom-packaging/pom.xml b/karaf/karaf-maven-plugin/src/it/test-kar-with-pom-packaging/pom.xml deleted file mode 100644 index b7832d744..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-kar-with-pom-packaging/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - 4.0.0 - - test - test-kar-with-pom-packaging - 1.0-SNAPSHOT - pom - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - - features-generate-descriptor - - - - kar - - kar - - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-kar-with-pom-packaging/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-kar-with-pom-packaging/verify.bsh deleted file mode 100644 index fce6de321..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-kar-with-pom-packaging/verify.bsh +++ /dev/null @@ -1,29 +0,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. - */ - -import java.io.*; -import java.lang.*; - -// check the kar archive was pushed to the repository -File generated = new File(basedir, "target/test-kar-with-pom-packaging-1.0-SNAPSHOT.kar"); -if (generated.exists()) { - return true; -} - -return false; \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-recursive/pom.xml b/karaf/karaf-maven-plugin/src/it/test-recursive/pom.xml deleted file mode 100644 index 4fbd79053..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-recursive/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - 4.0.0 - - test - test-recursive - 1.0-SNAPSHOT - pom - - - UTF-8 - - - - recursive-module-a - recursive-module-b - recursive-module-c - recursive-module-d - - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - package - - features-generate-descriptor - - - false - - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-a/pom.xml b/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-a/pom.xml deleted file mode 100644 index b68e49e69..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-a/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - 4.0.0 - - test - test-recursive - 1.0-SNAPSHOT - ../pom.xml - - - test - recursive-module-a - 1.0-SNAPSHOT - bundle - - - UTF-8 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-a/src/main/java/test/A.java b/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-a/src/main/java/test/A.java deleted file mode 100644 index 9aa5496e8..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-a/src/main/java/test/A.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.a; - -public class A -{ - public static String ASTRING = "A-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-b/pom.xml b/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-b/pom.xml deleted file mode 100644 index 824de1974..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-b/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - 4.0.0 - - test - test-recursive - 1.0-SNAPSHOT - ../pom.xml - - - test - recursive-module-b - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-b/src/main/java/test/B.java b/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-b/src/main/java/test/B.java deleted file mode 100644 index b66ddeafe..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-b/src/main/java/test/B.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.b; - -public class B -{ - public static String BSTRING = "B-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-c/pom.xml b/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-c/pom.xml deleted file mode 100644 index 664147d96..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-c/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - 4.0.0 - - test - test-recursive - 1.0-SNAPSHOT - ../pom.xml - - - test - recursive-module-c - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - test - recursive-module-a - 1.0-SNAPSHOT - - - test - recursive-module-b - 1.0-SNAPSHOT - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-c/src/main/java/test/C.java b/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-c/src/main/java/test/C.java deleted file mode 100644 index 630440f90..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-c/src/main/java/test/C.java +++ /dev/null @@ -1,30 +0,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. - */ - -package test.c; - -import test.a.*; -import test.b.*; - -public class C -{ - public static String createStringWithDependencies() { - return A.ASTRING + " " + B.BSTRING + " " + "C-string"; - } -} diff --git a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-d/pom.xml b/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-d/pom.xml deleted file mode 100644 index b1f8097fe..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-d/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - 4.0.0 - - test - test-recursive - 1.0-SNAPSHOT - ../pom.xml - - - test - recursive-module-d - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - test - recursive-module-c - 1.0-SNAPSHOT - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-d/src/main/java/test/D.java b/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-d/src/main/java/test/D.java deleted file mode 100644 index 370fad8a6..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-recursive/recursive-module-d/src/main/java/test/D.java +++ /dev/null @@ -1,29 +0,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. - */ - -package test.d; - -import test.c.*; - -public class D -{ - public String createStringWithDependencies() { - return C.createStringWithDependencies() + " " + "D-string"; - } -} diff --git a/karaf/karaf-maven-plugin/src/it/test-recursive/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-recursive/verify.bsh deleted file mode 100644 index c2b765a31..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-recursive/verify.bsh +++ /dev/null @@ -1,34 +0,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. - */ - -import org.custommonkey.xmlunit.*; -import java.io.*; -import java.lang.*; - -//String control = ""; -// -//File generated = new File( basedir, "target/feature/feature.xml" ); -//StringReader sr = new StringReader(control); -//try { -// XMLAssert.assertXMLEqual(sr, new FileReader(generated)); -//} catch (AssertionError ignored) { -// return false; -//} - -return true; diff --git a/karaf/karaf-maven-plugin/src/it/test-rename-main-feature/control.xml b/karaf/karaf-maven-plugin/src/it/test-rename-main-feature/control.xml deleted file mode 100644 index c6247905c..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-rename-main-feature/control.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - mvn:test/test-rename-project-artifact/1.0-SNAPSHOT - - diff --git a/karaf/karaf-maven-plugin/src/it/test-rename-main-feature/pom.xml b/karaf/karaf-maven-plugin/src/it/test-rename-main-feature/pom.xml deleted file mode 100644 index afd6990cd..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-rename-main-feature/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - 4.0.0 - - test - test-rename-project-artifact - 1.0-SNAPSHOT - bundle - - - UTF-8 - - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - package - - features-generate-descriptor - - - test-feature - true - - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-rename-main-feature/src/main/java/test/App.java b/karaf/karaf-maven-plugin/src/it/test-rename-main-feature/src/main/java/test/App.java deleted file mode 100644 index c95d24593..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-rename-main-feature/src/main/java/test/App.java +++ /dev/null @@ -1,30 +0,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. - */ -package test; - -/** - * Hello world! - */ -public class App { - - public static void main( String[] args ) { - System.out.println( "Hello World!" ); - } - -} diff --git a/karaf/karaf-maven-plugin/src/it/test-rename-main-feature/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-rename-main-feature/verify.bsh deleted file mode 100644 index 6af1a7c85..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-rename-main-feature/verify.bsh +++ /dev/null @@ -1,35 +0,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. - */ - -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, "target/feature/feature.xml" ); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} - -return false; diff --git a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/control.xml b/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/control.xml deleted file mode 100644 index 0cde6c9be..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/control.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - mvn:test/dependency-feature-b/1.0-SNAPSHOT/xml/features - - dependency-feature-b - mvn:test/dependency-bundle-a/1.0-SNAPSHOT - - diff --git a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-bundle-a/pom.xml b/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-bundle-a/pom.xml deleted file mode 100644 index 574d05b83..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-bundle-a/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - 4.0.0 - - test - test-repository-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-bundle-a - 1.0-SNAPSHOT - bundle - - - UTF-8 - - - - - test - dependency-feature-b - ${project.version} - features - xml - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-bundle-a/src/main/java/test/A.java b/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-bundle-a/src/main/java/test/A.java deleted file mode 100644 index 9aa5496e8..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-bundle-a/src/main/java/test/A.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.a; - -public class A -{ - public static String ASTRING = "A-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-bundle-b/pom.xml b/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-bundle-b/pom.xml deleted file mode 100644 index 639b73d25..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-bundle-b/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - 4.0.0 - - test - test-repository-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-bundle-b - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-bundle-b/src/main/java/test/B.java b/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-bundle-b/src/main/java/test/B.java deleted file mode 100644 index b66ddeafe..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-bundle-b/src/main/java/test/B.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.b; - -public class B -{ - public static String BSTRING = "B-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-feature-a/pom.xml b/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-feature-a/pom.xml deleted file mode 100644 index 4a7e0a2d1..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-feature-a/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - 4.0.0 - - test - test-repository-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-feature-a - 1.0-SNAPSHOT - feature - - - UTF-8 - - - - - test - dependency-bundle-a - ${project.version} - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - generate-features-file - package - - features-generate-descriptor - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-feature-b/pom.xml b/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-feature-b/pom.xml deleted file mode 100644 index 8f02f5189..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/dependency-feature-b/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - 4.0.0 - - test - test-repository-dependencies - 1.0-SNAPSHOT - ../pom.xml - - - test - dependency-feature-b - 1.0-SNAPSHOT - feature - - - UTF-8 - - - - - test - dependency-bundle-b - ${project.version} - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - generate-features-file - package - - features-generate-descriptor - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/pom.xml b/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/pom.xml deleted file mode 100644 index 063e4ff37..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - 4.0.0 - - test - test-repository-dependencies - 1.0-SNAPSHOT - pom - - - UTF-8 - - - - - - dependency-feature-a - dependency-bundle-a - dependency-feature-b - dependency-bundle-b - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - 256M - ${compiler.fork} - - - - org.apache.felix - maven-bundle-plugin - true - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - package - - features-generate-descriptor - - - - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/verify.bsh deleted file mode 100644 index 97f7ccc25..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-repository-dependencies/verify.bsh +++ /dev/null @@ -1,35 +0,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. - */ - -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, "dependency-feature-a/target/feature/feature.xml" ); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} - -return false; diff --git a/karaf/karaf-maven-plugin/src/it/test-run-bundle/pom.xml b/karaf/karaf-maven-plugin/src/it/test-run-bundle/pom.xml deleted file mode 100644 index b67aefc3c..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-run-bundle/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - 4.0.0 - - test - test-run-bundle - 1.0-SNAPSHOT - bundle - - - - - org.apache.felix - maven-bundle-plugin - 2.5.4 - true - true - - - * - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - run - integration-test - - run - - - mvn:org.apache.karaf/apache-karaf/4.0.3/zip - false - true - - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-run-bundle/src/main/java/test/Dummy.java b/karaf/karaf-maven-plugin/src/it/test-run-bundle/src/main/java/test/Dummy.java deleted file mode 100644 index 082d7f2a5..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-run-bundle/src/main/java/test/Dummy.java +++ /dev/null @@ -1,25 +0,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. - */ -package test; - -public class Dummy { - - // nothing - -} \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-run/pom.xml b/karaf/karaf-maven-plugin/src/it/test-run/pom.xml deleted file mode 100644 index d0d4a69b9..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-run/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - 4.0.0 - - test - test-run - 1.0-SNAPSHOT - pom - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - run - - run - - - mvn:org.apache.karaf/apache-karaf/4.0.3/zip - false - false - - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/control.xml b/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/control.xml deleted file mode 100644 index 94cb36a03..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/control.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - mvn:test/simplify-feature-a/1.0-SNAPSHOT/xml/features - -
Check that bundles are simplified
- simplify-feature-a - mvn:test/simplify-bundle-b/1.0-SNAPSHOT - mvn:test/simplify-bundle-a/1.0-SNAPSHOT -
- -
Check that bundles are simplified
- simplify-feature-a - mvn:test/simplify-bundle-b/1.0-SNAPSHOT -
- -
Check that bundles are simplified
- simplify-feature-as-is - simplify-feature-reduced -
-
diff --git a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/pom.xml b/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/pom.xml deleted file mode 100644 index b61c6a3bf..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - 4.0.0 - - test - test-simplify-bundles - 1.0-SNAPSHOT - - pom - - Check that bundles are simplified - - - - - UTF-8 - - - - simplify-bundle-a - simplify-bundle-b - simplify-feature-a - simplify-feature-as-is - simplify-feature-reduced - simplify-features - - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - package - - features-generate-descriptor - - - - - - - - \ No newline at end of file diff --git a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/pom.xml b/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/pom.xml deleted file mode 100644 index 27dfccdd1..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - 4.0.0 - - test - test-simplify-bundles - 1.0-SNAPSHOT - ../pom.xml - - - test - simplify-bundle-a - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/src/main/java/test/A.java b/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/src/main/java/test/A.java deleted file mode 100644 index 9aa5496e8..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/src/main/java/test/A.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.a; - -public class A -{ - public static String ASTRING = "A-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/pom.xml b/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/pom.xml deleted file mode 100644 index f84310f39..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - 4.0.0 - - test - test-simplify-bundles - 1.0-SNAPSHOT - ../pom.xml - - - test - simplify-bundle-b - 1.0-SNAPSHOT - - bundle - - - UTF-8 - - - - - test - simplify-feature-a - 1.0-SNAPSHOT - xml - features - - - test - simplify-bundle-a - 1.0-SNAPSHOT - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/src/main/java/test/B.java b/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/src/main/java/test/B.java deleted file mode 100644 index b66ddeafe..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/src/main/java/test/B.java +++ /dev/null @@ -1,25 +0,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. - */ - -package test.b; - -public class B -{ - public static String BSTRING = "B-string"; -} diff --git a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-a/pom.xml b/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-a/pom.xml deleted file mode 100644 index abbf8a926..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-a/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - 4.0.0 - - test - test-simplify-bundles - 1.0-SNAPSHOT - ../pom.xml - - - test - simplify-feature-a - 1.0-SNAPSHOT - - feature - - - UTF-8 - - - - - test - simplify-bundle-a - 1.0-SNAPSHOT - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - generate-features-file - package - - features-generate-descriptor - - - true - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-as-is/pom.xml b/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-as-is/pom.xml deleted file mode 100644 index 3bab1f6ac..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-as-is/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - 4.0.0 - - test - test-simplify-bundles - 1.0-SNAPSHOT - ../pom.xml - - - test - simplify-feature-as-is - 1.0-SNAPSHOT - - feature - - - UTF-8 - - - - - test - simplify-bundle-b - 1.0-SNAPSHOT - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - generate-features-file - package - - features-generate-descriptor - - - true - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-reduced/pom.xml b/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-reduced/pom.xml deleted file mode 100644 index 0c3247b87..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-reduced/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - 4.0.0 - - test - test-simplify-bundles - 1.0-SNAPSHOT - ../pom.xml - - - test - simplify-feature-reduced - 1.0-SNAPSHOT - - feature - - - UTF-8 - - - - - test - simplify-bundle-b - 1.0-SNAPSHOT - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - generate-features-file - package - - features-generate-descriptor - - - true - true - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-features/pom.xml b/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-features/pom.xml deleted file mode 100644 index da5ca3579..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-features/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - 4.0.0 - - test - test-simplify-bundles - 1.0-SNAPSHOT - ../pom.xml - - - test - simplify-features - 1.0-SNAPSHOT - - feature - - - UTF-8 - - - - - test - simplify-feature-as-is - 1.0-SNAPSHOT - xml - features - - - test - simplify-feature-reduced - 1.0-SNAPSHOT - xml - features - - - - - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - true - - - generate-features-file - package - - features-generate-descriptor - - - true - true - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/verify.bsh deleted file mode 100644 index 78f37fd8f..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-simplify-bundles/verify.bsh +++ /dev/null @@ -1,34 +0,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. - */ - -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, "simplify-features/target/feature/feature.xml"); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} -return false; diff --git a/karaf/karaf-maven-plugin/src/it/test-type-classifier/control.xml b/karaf/karaf-maven-plugin/src/it/test-type-classifier/control.xml deleted file mode 100644 index 246e2cf5c..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-type-classifier/control.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-type-classifier/pom.xml b/karaf/karaf-maven-plugin/src/it/test-type-classifier/pom.xml deleted file mode 100644 index eeb048a2b..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-type-classifier/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - 4.0.0 - - test - test-type-classifier - 1.0-SNAPSHOT - bundle - - - UTF-8 - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - org.apache.karaf.tooling - karaf-maven-plugin - @pom.version@ - - - generate-features-file - package - - features-generate-descriptor - - - zazzle - fershizzle - - - - - - - diff --git a/karaf/karaf-maven-plugin/src/it/test-type-classifier/src/main/java/test/App.java b/karaf/karaf-maven-plugin/src/it/test-type-classifier/src/main/java/test/App.java deleted file mode 100644 index fedb5dab2..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-type-classifier/src/main/java/test/App.java +++ /dev/null @@ -1,32 +0,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. - */ - -package test; - -/** - * Hello world! - * - */ -public class App -{ - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } -} diff --git a/karaf/karaf-maven-plugin/src/it/test-type-classifier/verify.bsh b/karaf/karaf-maven-plugin/src/it/test-type-classifier/verify.bsh deleted file mode 100644 index d82e6fff6..000000000 --- a/karaf/karaf-maven-plugin/src/it/test-type-classifier/verify.bsh +++ /dev/null @@ -1,38 +0,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. - */ - -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 -// TODO: we can't actually test the classifier and type unless we install the artifact -// TODO: but we don't want to pollute the user repo and we can't really use a different -// TODO: repository and build offline (see KARAF-2927) -File generated = new File(basedir, "target/feature/feature.xml"); -if (generated.exists()) { - try { - XMLAssert.assertXMLEqual(r, new FileReader(generated)); - return true; - } catch (Throwable ignored) { } -} - -return false; diff --git a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/ArchiveMojo.java b/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/ArchiveMojo.java deleted file mode 100644 index a906dae71..000000000 --- a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/ArchiveMojo.java +++ /dev/null @@ -1,272 +0,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. - */ -package org.apache.karaf.tooling; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.nio.file.DirectoryStream; -import java.nio.file.Files; -import java.nio.file.Path; - -import org.apache.commons.compress.archivers.tar.TarArchiveEntry; -import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; -import org.apache.commons.compress.archivers.tar.TarConstants; -import org.apache.commons.compress.archivers.zip.UnixStat; -import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; -import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; -import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream; -import org.apache.karaf.tooling.utils.MojoSupport; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; - -/** - * Package a server archive from an assembled server - */ -@Mojo(name = "archive", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true) -public class ArchiveMojo extends MojoSupport { - - /** - * The target directory of the project. - */ - @Parameter(defaultValue="${project.build.directory}") - private File destDir; - - /** - * The location of the server repository. - */ - @Parameter(defaultValue="${project.build.directory}/assembly") - private File targetServerDirectory; - - /** - * Path prefix of files in the created archive. - */ - @Parameter(defaultValue="${project.artifactId}-${project.version}") - private String pathPrefix; - - /** - * Use a path prefix of files in the created archive - */ - @Parameter - private boolean usePathPrefix = true; - - /** - * The target file to set as the project's artifact. - */ - @Parameter(defaultValue="${project.artifactId}-${project.version}") - private File targetFile; - - /** - * pack a assembly as a tar.gz archive - */ - @Parameter - private boolean archiveTarGz = true; - - /** - * pack a assembly as a zip archive - */ - @Parameter - private boolean archiveZip = true; - - /** - * Whether to attach the resulting assembly to the project as an artifact. - */ - @Parameter(defaultValue="true") - private boolean attach = true; - - /** - * If supplied, the classifer for the artifact when attached. - */ - @Parameter - private String classifier; - - /** - * use symbolic links in tar.gz or zip archives - * - * Symbolic links are not very well supported by windows Platform. - * At least, is does not work on WinXP + NTFS, so do not include them - * for now. So the default is false. - */ - @Parameter - private boolean useSymLinks = false; - - public void execute() throws MojoExecutionException, MojoFailureException { - getLog().debug("Setting artifact file: " + targetFile); - org.apache.maven.artifact.Artifact artifact = project.getArtifact(); - artifact.setFile(targetFile); - try { - //now pack up the server. - if(archiveTarGz){ - archive("tar.gz"); - } - if(archiveZip) { - archive("zip"); - } - } catch (Exception e) { - throw new MojoExecutionException("Could not archive plugin", e); - } - } - - @SuppressWarnings("deprecation") - private void archive(String type) throws IOException { - Artifact artifact1 = factory.createArtifactWithClassifier(project.getArtifact().getGroupId(), project.getArtifact().getArtifactId(), project.getArtifact().getVersion(), type, "bin"); - File target1 = archive(targetServerDirectory, destDir, artifact1); - - // artifact1 is created with explicit classifier "bin", which is dropped below when attachArtifact is called - // which means we can't use artifact1.equals(artifact) directly with artifact1 - Artifact artifact2 = factory.createArtifact(artifact1.getGroupId(), artifact1.getArtifactId(), artifact1.getVersion(), artifact1.getScope(), artifact1.getType()); - for (Artifact artifact : project.getAttachedArtifacts()) { - if (artifact2.equals(artifact)) { - getLog().debug("Artifact " + artifact2 + " already attached"); - return; - } - } - if (attach) { - projectHelper.attachArtifact(project, artifact1.getType(), classifier, target1); - } - } - - public File archive(File source, File dest, Artifact artifact) throws //ArchiverException, - IOException { - String serverName = null; - if (targetFile != null) { - serverName = targetFile.getName(); - } else { - serverName = artifact.getArtifactId() + "-" + artifact.getVersion(); - } - dest = new File(dest, serverName + "." + artifact.getType()); - - String prefix = ""; - if (usePathPrefix) { - prefix = pathPrefix.trim(); - if( prefix.length() > 0 && !prefix.endsWith("/") ) { - prefix += "/"; - } - } - - if ("tar.gz".equals(artifact.getType())) { - try ( - OutputStream fOut = Files.newOutputStream(dest.toPath()); - OutputStream bOut = new BufferedOutputStream(fOut); - OutputStream gzOut = new GzipCompressorOutputStream(bOut); - TarArchiveOutputStream tOut = new TarArchiveOutputStream(gzOut); - DirectoryStream children = Files.newDirectoryStream(source.toPath()) - - ) { - tOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX); - tOut.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX); - for (Path child : children) { - addFileToTarGz(tOut, child, prefix); - } - } - } else if ("zip".equals(artifact.getType())) { - try ( - OutputStream fOut = Files.newOutputStream(dest.toPath()); - OutputStream bOut = new BufferedOutputStream(fOut); - ZipArchiveOutputStream tOut = new ZipArchiveOutputStream(bOut); - DirectoryStream children = Files.newDirectoryStream(source.toPath()) - - ) { - for (Path child : children) { - addFileToZip(tOut, child, prefix); - } - } - } else { - throw new IllegalArgumentException("Unknown target type: " + artifact.getType()); - } - - return dest; - } - - private void addFileToTarGz(TarArchiveOutputStream tOut, Path f, String base) throws IOException { - if (Files.isDirectory(f)) { - String entryName = base + f.getFileName().toString() + "/"; - TarArchiveEntry tarEntry = new TarArchiveEntry(entryName); - tOut.putArchiveEntry(tarEntry); - tOut.closeArchiveEntry(); - try (DirectoryStream children = Files.newDirectoryStream(f)) { - for (Path child : children) { - addFileToTarGz(tOut, child, entryName); - } - } - } else if (useSymLinks && Files.isSymbolicLink(f)) { - String entryName = base + f.getFileName().toString(); - TarArchiveEntry tarEntry = new TarArchiveEntry(entryName, TarConstants.LF_SYMLINK); - tarEntry.setLinkName(Files.readSymbolicLink(f).toString()); - tOut.putArchiveEntry(tarEntry); - tOut.closeArchiveEntry(); - } else { - String entryName = base + f.getFileName().toString(); - TarArchiveEntry tarEntry = new TarArchiveEntry(entryName); - tarEntry.setSize(Files.size(f)); - if (entryName.contains("/bin/") || (!usePathPrefix && entryName.startsWith("bin/"))) { - if (entryName.endsWith(".bat")) { - tarEntry.setMode(0644); - } else { - tarEntry.setMode(0755); - } - } - tOut.putArchiveEntry(tarEntry); - Files.copy(f, tOut); - tOut.closeArchiveEntry(); - } - } - - private void addFileToZip(ZipArchiveOutputStream tOut, Path f, String base) throws IOException { - if (Files.isDirectory(f)) { - String entryName = base + f.getFileName().toString() + "/"; - ZipArchiveEntry zipEntry = new ZipArchiveEntry(entryName); - tOut.putArchiveEntry(zipEntry); - tOut.closeArchiveEntry(); - try (DirectoryStream children = Files.newDirectoryStream(f)) { - for (Path child : children) { - addFileToZip(tOut, child, entryName); - } - } - } else if (useSymLinks && Files.isSymbolicLink(f)) { - String entryName = base + f.getFileName().toString(); - ZipArchiveEntry zipEntry = new ZipArchiveEntry(entryName); - zipEntry.setUnixMode(UnixStat.LINK_FLAG | UnixStat.DEFAULT_FILE_PERM); - tOut.putArchiveEntry(zipEntry); - tOut.write(Files.readSymbolicLink(f).toString().getBytes()); - tOut.closeArchiveEntry(); - } else { - String entryName = base + f.getFileName().toString(); - ZipArchiveEntry zipEntry = new ZipArchiveEntry(entryName); - zipEntry.setSize(Files.size(f)); - if (entryName.contains("/bin/") || (!usePathPrefix && entryName.startsWith("bin"))) { - if (!entryName.endsWith(".bat")) { - zipEntry.setUnixMode(0755); - } else { - zipEntry.setUnixMode(0644); - } - } - tOut.putArchiveEntry(zipEntry); - Files.copy(f, tOut); - tOut.closeArchiveEntry(); - } - } - -} diff --git a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java b/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java deleted file mode 100644 index 8bdfc5004..000000000 --- a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java +++ /dev/null @@ -1,475 +0,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. - */ -package org.apache.karaf.tooling; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.attribute.PosixFilePermissions; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.karaf.profile.assembly.Builder; -import org.apache.karaf.tooling.utils.IoUtils; -import org.apache.karaf.tooling.utils.MavenUtil; -import org.apache.karaf.tooling.utils.MojoSupport; -import org.apache.karaf.tools.utils.model.KarafPropertyEdits; -import org.apache.karaf.tools.utils.model.io.stax.KarafPropertyInstructionsModelStaxReader; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.attribute.PosixFilePermissions; -import java.util.ArrayList; -import java.util.List; - -/** - * Creates a customized Karaf distribution by installing features and setting up - * configuration files. The plugin gets features from feature.xml files and KAR - * archives declared as dependencies or as files configured with the - * featureRespositories parameter. It picks up other files, such as config files, - * from ${project.build.directory}/classes. Thus, a file in src/main/resources/etc - * will be copied by the resource plugin to ${project.build.directory}/classes/etc, - * and then added to the assembly by this goal. - *
- */ -@Mojo(name = "assembly", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true) -public class AssemblyMojo extends MojoSupport { - - /** - * Base directory used to overwrite resources in generated assembly after the build (resource directory). - */ - @Parameter(defaultValue = "${project.basedir}/src/main/resources/assembly") - protected File sourceDirectory; - - /** - * Base directory used to copy the resources during the build (working directory). - */ - @Parameter(defaultValue = "${project.build.directory}/assembly") - protected File workDirectory; - - /** - * Features configuration file (etc/org.apache.karaf.features.cfg). - */ - @Parameter(defaultValue = "${project.build.directory}/assembly/etc/org.apache.karaf.features.cfg") - protected File featuresCfgFile; - - /** - * startup.properties file. - */ - @Parameter(defaultValue = "${project.build.directory}/assembly/etc/startup.properties") - protected File startupPropertiesFile; - - /** - * Directory used during build to construction the Karaf system repository. - */ - @Parameter(defaultValue="${project.build.directory}/assembly/system") - protected File systemDirectory; - - /** - * default start level for bundles in features that don't specify it. - */ - @Parameter - protected int defaultStartLevel = 30; - - @Parameter - private List startupRepositories; - @Parameter - private List bootRepositories; - @Parameter - private List installedRepositories; - - /** - * List of features from runtime-scope features xml and kars to be installed into system and listed in startup.properties. - */ - @Parameter - private List startupFeatures; - - /** - * List of features from runtime-scope features xml and kars to be installed into system repo and listed in features service boot features. - */ - @Parameter - private List bootFeatures; - - /** - * List of features from runtime-scope features xml and kars to be installed into system repo and not mentioned elsewhere. - */ - @Parameter - private List installedFeatures; - - @Parameter - private List blacklistedFeatures; - - @Parameter - private List startupBundles; - @Parameter - private List bootBundles; - @Parameter - private List installedBundles; - @Parameter - private List blacklistedBundles; - - @Parameter - private String profilesUri; - - @Parameter - private List bootProfiles; - - @Parameter - private List startupProfiles; - - @Parameter - private List installedProfiles; - - @Parameter - private List blacklistedProfiles; - - @Parameter - private Builder.BlacklistPolicy blacklistPolicy = Builder.BlacklistPolicy.Discard; - - /** - * Ignore the dependency attribute (dependency="[true|false]") on bundle - */ - @Parameter(defaultValue = "false") - protected boolean ignoreDependencyFlag; - - /** - * Additional feature repositories - */ - @Parameter - protected List featureRepositories; - - @Parameter - protected List libraries; - - /** - * Use reference: style urls in startup.properties - */ - @Parameter(defaultValue = "false") - protected boolean useReferenceUrls; - - /** - * Include project build output directory in the assembly - */ - @Parameter(defaultValue = "true") - protected boolean includeBuildOutputDirectory; - - @Parameter - protected boolean installAllFeaturesByDefault = true; - - @Parameter - protected Builder.KarafVersion karafVersion = Builder.KarafVersion.v4x; - - /** - * Specify the version of Java SE to be assumed for osgi.ee. - */ - @Parameter(defaultValue = "1.7") - protected String javase; - - /** - * Specify an XML file that instructs this goal to apply edits to - * one or more standard Karaf property files. - * The contents of this file are documented in detail on - * this page. - * This allows you to - * customize these files without making copies in your resources - * directories. Here's a simple example: - * {@literal -
-      
-         
-          
-            config.properties
-            put
-            karaf.framework
-            equinox
-          
-          
-            config.properties
-            extend
-            org.osgi.framework.system.capabilities
-            my-magic-capability
-          
-          
-            config.properties
-            extend
-            some-other-list
-            my-value-goes-first
-            
-         
-      
-     
- } - */ - @Parameter(defaultValue = "${project.basedir}/src/main/karaf/assembly-property-edits.xml") - protected String propertyFileEdits; - - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - try { - doExecute(); - } - catch (MojoExecutionException | MojoFailureException e) { - throw e; - } - catch (Exception e) { - throw new MojoExecutionException("Unable to build assembly", e); - } - } - - protected void doExecute() throws Exception { - startupRepositories = nonNullList(startupRepositories); - bootRepositories = nonNullList(bootRepositories); - installedRepositories = nonNullList(installedRepositories); - startupBundles = nonNullList(startupBundles); - bootBundles = nonNullList(bootBundles); - installedBundles = nonNullList(installedBundles); - blacklistedBundles = nonNullList(blacklistedBundles); - startupFeatures = nonNullList(startupFeatures); - bootFeatures = nonNullList(bootFeatures); - installedFeatures = nonNullList(installedFeatures); - blacklistedFeatures = nonNullList(blacklistedFeatures); - startupProfiles = nonNullList(startupProfiles); - bootProfiles = nonNullList(bootProfiles); - installedProfiles = nonNullList(installedProfiles); - blacklistedProfiles = nonNullList(blacklistedProfiles); - - if (!startupProfiles.isEmpty() || !bootProfiles.isEmpty() || !installedProfiles.isEmpty()) { - if (profilesUri == null) { - throw new IllegalArgumentException("profilesDirectory must be specified"); - } - } - - if (featureRepositories != null && !featureRepositories.isEmpty()) { - getLog().warn("Use of featureRepositories is deprecated, use startupRepositories, bootRepositories or installedRepositories instead"); - startupRepositories.addAll(featureRepositories); - bootRepositories.addAll(featureRepositories); - installedRepositories.addAll(featureRepositories); - } - - StringBuilder remote = new StringBuilder(); - for (Object obj : project.getRemoteProjectRepositories()) { - if (remote.length() > 0) { - remote.append(","); - } - remote.append(invoke(obj, "getUrl")); - remote.append("@id=").append(invoke(obj, "getId")); - if (!((Boolean) invoke(getPolicy(obj, false), "isEnabled"))) { - remote.append("@noreleases"); - } - if ((Boolean) invoke(getPolicy(obj, true), "isEnabled")) { - remote.append("@snapshots"); - } - } - getLog().info("Using repositories: " + remote.toString()); - - Builder builder = Builder.newInstance(); - builder.offline(mavenSession.isOffline()); - builder.localRepository(localRepo.getBasedir()); - builder.mavenRepositories(remote.toString()); - builder.javase(javase); - - // Set up blacklisted items - builder.blacklistBundles(blacklistedBundles); - builder.blacklistFeatures(blacklistedFeatures); - builder.blacklistProfiles(blacklistedProfiles); - builder.blacklistPolicy(blacklistPolicy); - - if (propertyFileEdits != null) { - File file = new File(propertyFileEdits); - if (file.exists()) { - KarafPropertyEdits edits; - try (InputStream editsStream = new FileInputStream(propertyFileEdits)) { - KarafPropertyInstructionsModelStaxReader kipmsr = new KarafPropertyInstructionsModelStaxReader(); - edits = kipmsr.read(editsStream, true); - } - builder.propertyEdits(edits); - } - } - - // creating system directory - getLog().info("Creating work directory"); - builder.homeDirectory(workDirectory.toPath()); - IoUtils.deleteRecursive(workDirectory); - workDirectory.mkdirs(); - - List startupKars = new ArrayList<>(); - List bootKars = new ArrayList<>(); - List installedKars = new ArrayList<>(); - - // Loading kars and features repositories - getLog().info("Loading kar and features repositories dependencies"); - for (Artifact artifact : project.getDependencyArtifacts()) { - Builder.Stage stage; - switch (artifact.getScope()) { - case "compile": - stage = Builder.Stage.Startup; - break; - case "runtime": - stage = Builder.Stage.Boot; - break; - case "provided": - stage = Builder.Stage.Installed; - break; - default: - continue; - } - if ("kar".equals(artifact.getType())) { - String uri = artifactToMvn(artifact); - switch (stage) { - case Startup: startupKars.add(uri); break; - case Boot: bootKars.add(uri); break; - case Installed: installedKars.add(uri); break; - } - } else if ("features".equals(artifact.getClassifier())) { - String uri = artifactToMvn(artifact); - switch (stage) { - case Startup: startupRepositories.add(uri); break; - case Boot: bootRepositories.add(uri); break; - case Installed: installedRepositories.add(uri); break; - } - } else if ("jar".equals(artifact.getType()) || "bundle".equals(artifact.getType())) { - String uri = artifactToMvn(artifact); - switch (stage) { - case Startup: startupBundles.add(uri); break; - case Boot: bootBundles.add(uri); break; - case Installed: installedBundles.add(uri); break; - } - } - } - - builder.karafVersion(karafVersion) - .useReferenceUrls(useReferenceUrls) - .defaultAddAll(installAllFeaturesByDefault) - .ignoreDependencyFlag(ignoreDependencyFlag); - if (profilesUri != null) { - builder.profilesUris(profilesUri); - } - if (libraries != null) { - builder.libraries(libraries.toArray(new String[libraries.size()])); - } - // Startup - builder.defaultStage(Builder.Stage.Startup) - .kars(toArray(startupKars)) - .repositories(startupFeatures.isEmpty() && startupProfiles.isEmpty() && installAllFeaturesByDefault, toArray(startupRepositories)) - .features(toArray(startupFeatures)) - .bundles(toArray(startupBundles)) - .profiles(toArray(startupProfiles)); - // Boot - builder.defaultStage(Builder.Stage.Boot) - .kars(toArray(bootKars)) - .repositories(bootFeatures.isEmpty() && bootProfiles.isEmpty() && installAllFeaturesByDefault, toArray(bootRepositories)) - .features(toArray(bootFeatures)) - .bundles(toArray(bootBundles)) - .profiles(toArray(bootProfiles)); - // Installed - builder.defaultStage(Builder.Stage.Installed) - .kars(toArray(installedKars)) - .repositories(installedFeatures.isEmpty() && installedProfiles.isEmpty() && installAllFeaturesByDefault, toArray(installedRepositories)) - .features(toArray(installedFeatures)) - .bundles(toArray(installedBundles)) - .profiles(toArray(installedProfiles)); - - // Generate the assembly - builder.generateAssembly(); - - // Include project classes content - if (includeBuildOutputDirectory) - IoUtils.copyDirectory(new File(project.getBuild().getOutputDirectory()), workDirectory); - - // Overwrite assembly dir contents - if (sourceDirectory.exists()) - IoUtils.copyDirectory(sourceDirectory, workDirectory); - - // Chmod the bin/* scripts - File[] files = new File(workDirectory, "bin").listFiles(); - if( files!=null ) { - for (File file : files) { - if( !file.getName().endsWith(".bat") ) { - try { - Files.setPosixFilePermissions(file.toPath(), PosixFilePermissions.fromString("rwxr-xr-x")); - } catch (Throwable ignore) { - // we tried our best, perhaps the OS does not support posix file perms. - } - } - } - } - } - - private Object invoke(Object object, String getter) throws MojoExecutionException { - try { - return object.getClass().getMethod(getter).invoke(object); - } catch (Exception e) { - throw new MojoExecutionException("Unable to build remote repository from " + object.toString(), e); - } - } - - private Object getPolicy(Object object, boolean snapshots) throws MojoExecutionException { - return invoke(object, "getPolicy", new Class[] { Boolean.TYPE }, new Object[] { snapshots }); - } - - private Object invoke(Object object, String getter, Class[] types, Object[] params) throws MojoExecutionException { - try { - return object.getClass().getMethod(getter, types).invoke(object, params); - } catch (Exception e) { - throw new MojoExecutionException("Unable to build remote repository from " + object.toString(), e); - } - } - - private String artifactToMvn(Artifact artifact) throws MojoExecutionException { - String uri; - - String groupId = artifact.getGroupId(); - String artifactId = artifact.getArtifactId(); - String version = artifact.getBaseVersion(); - String type = artifact.getArtifactHandler().getExtension(); - String classifier = artifact.getClassifier(); - - if (MavenUtil.isEmpty(classifier)) { - if ("jar".equals(type)) { - uri = String.format("mvn:%s/%s/%s", groupId, artifactId, version); - } else { - uri = String.format("mvn:%s/%s/%s/%s", groupId, artifactId, version, type); - } - } else { - uri = String.format("mvn:%s/%s/%s/%s/%s", groupId, artifactId, version, type, classifier); - } - return uri; - } - - private String[] toArray(List strings) { - return strings.toArray(new String[strings.size()]); - } - - private List nonNullList(List list) { - return list == null ? new ArrayList() : list; - } - -} diff --git a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/KarMojo.java b/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/KarMojo.java deleted file mode 100644 index db383eb99..000000000 --- a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/KarMojo.java +++ /dev/null @@ -1,403 +0,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. - */ -package org.apache.karaf.tooling; - -import java.io.*; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.karaf.deployer.kar.KarArtifactInstaller; -import org.apache.karaf.features.BundleInfo; -import org.apache.karaf.features.ConfigFileInfo; -import org.apache.karaf.features.internal.model.Feature; -import org.apache.karaf.features.internal.model.Features; -import org.apache.karaf.features.internal.model.JaxbUtil; -import org.apache.karaf.tooling.utils.MavenUtil; -import org.apache.karaf.tooling.utils.MojoSupport; -import org.apache.maven.archiver.MavenArchiveConfiguration; -import org.apache.maven.archiver.MavenArchiver; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; -import org.apache.maven.artifact.repository.metadata.Metadata; -import org.apache.maven.artifact.repository.metadata.Snapshot; -import org.apache.maven.artifact.repository.metadata.SnapshotVersion; -import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.codehaus.plexus.archiver.Archiver; -import org.codehaus.plexus.archiver.jar.JarArchiver; - -/** - * Assemble a kar archive from a features.xml file - */ -@Mojo(name = "kar", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true) -public class KarMojo extends MojoSupport { - - /** - * The maven archive configuration to use. - *

- * See the Javadocs for MavenArchiveConfiguration. - */ - @Parameter - private MavenArchiveConfiguration archive = new MavenArchiveConfiguration(); - - /** - * The Jar archiver. - */ - @Component(role = Archiver.class, hint="jar") - private JarArchiver jarArchiver = null; - - /** - * Directory containing the generated archive. - */ - @Parameter(defaultValue = "${project.build.directory}") - private File outputDirectory = null; - - /** - * Name of the generated archive. - */ - @Parameter(defaultValue = "${project.build.finalName}") - private String finalName = null; - - /** - * Ignore the dependency flag on the bundles in the features XML - */ - @Parameter(defaultValue = "false") - private boolean ignoreDependencyFlag; - - /** - * Classifier to add to the artifact generated. If given, the artifact will be attached. - * If it's not given, it will merely be written to the output directory according to the finalName. - */ - @Parameter - protected String classifier; - - /** - * Location of resources directory for additional content to include in the kar. - * Note that it includes everything under classes so as to include maven-remote-resources - */ - @Parameter(defaultValue = "${project.build.directory}/classes") - private File resourcesDir; - - - /** - * The features file to use as instructions - */ - @Parameter(defaultValue = "${project.build.directory}/feature/feature.xml") - private String featuresFile; - - - /** - * The wrapper repository in the kar. - */ - @Parameter(defaultValue = "${repositoryPath}") - private String repositoryPath = "repository/"; - - private static final Pattern mvnPattern = Pattern.compile("mvn:([^/ ]+)/([^/ ]+)/([^/ ]*)(/([^/ ]+)(/([^/ ]+))?)?"); - - - // - // Mojo - // - - public void execute() throws MojoExecutionException, MojoFailureException { - File featuresFileResolved = resolveFile(featuresFile); - String groupId = project.getGroupId(); - String artifactId = project.getArtifactId(); - String version = project.getVersion(); - - if (isMavenUrl(featuresFile)) { - Artifact artifactTemp = resourceToArtifact(featuresFile, false); - if (artifactTemp.getGroupId() != null) - groupId = artifactTemp.getGroupId(); - if (artifactTemp.getArtifactHandler() != null) - artifactId = artifactTemp.getArtifactId(); - if (artifactTemp.getVersion() != null) - version = artifactTemp.getVersion(); - } - - List resources = readResources(featuresFileResolved); - - // Build the archive - File archive = createArchive(resources, featuresFileResolved, groupId, artifactId, version); - - // if no classifier is specified and packaging is not kar, display a warning - // and attach artifact - if (classifier == null && !this.getProject().getPackaging().equals("kar")) { - this.getLog().warn("Your project should use the \"kar\" packaging or configure a \"classifier\" for kar attachment"); - projectHelper.attachArtifact(getProject(), "kar", null, archive); - return; - } - - // Attach the generated archive for install/deploy - if (classifier != null) { - projectHelper.attachArtifact(getProject(), "kar", classifier, archive); - } else { - getProject().getArtifact().setFile(archive); - } - } - - private File resolveFile(String file) { - File fileResolved = null; - - if (isMavenUrl(file)) { - fileResolved = new File(fromMaven(file)); - try { - Artifact artifactTemp = resourceToArtifact(file, false); - if (!fileResolved.exists()) { - try { - artifactResolver.resolve(artifactTemp, remoteRepos, localRepo); - fileResolved = artifactTemp.getFile(); - } catch (ArtifactResolutionException e) { - getLog().error("Artifact was not resolved", e); - } catch (ArtifactNotFoundException e) { - getLog().error("Artifact was not found", e); - } - } - } catch (MojoExecutionException e) { - getLog().error(e); - } - } else { - fileResolved = new File(file); - } - - return fileResolved; - } - - /** - * Read bundles and configuration files in the features file. - * - * @return - * @throws MojoExecutionException - */ - private List readResources(File featuresFile) throws MojoExecutionException { - List resources = new ArrayList(); - try { - Features features = JaxbUtil.unmarshal(featuresFile.toURI().toASCIIString(), false); - for (Feature feature : features.getFeature()) { - for (BundleInfo bundle : feature.getBundles()) { - if (ignoreDependencyFlag || (!ignoreDependencyFlag && !bundle.isDependency())) { - resources.add(resourceToArtifact(bundle.getLocation(), false)); - } - } - for (ConfigFileInfo configFile : feature.getConfigurationFiles()) { - resources.add(resourceToArtifact(configFile.getLocation(), false)); - } - } - return resources; - } catch (MojoExecutionException e) { - throw e; - } catch (Exception e) { - throw new MojoExecutionException("Could not interpret features.xml", e); - } - } - - /** - * Generates the configuration archive. - * - * @param bundles - */ - @SuppressWarnings("deprecation") - private File createArchive(List bundles, File featuresFile, String groupId, String artifactId, String version) throws MojoExecutionException { - ArtifactRepositoryLayout layout = new DefaultRepositoryLayout(); - File archiveFile = getArchiveFile(outputDirectory, finalName, classifier); - - MavenArchiver archiver = new MavenArchiver(); - archiver.setArchiver(jarArchiver); - archiver.setOutputFile(archiveFile); - - try { - //TODO should .kar be a bundle? -// archive.addManifestEntry(Constants.BUNDLE_NAME, project.getName()); -// archive.addManifestEntry(Constants.BUNDLE_VENDOR, project.getOrganization().getName()); -// ArtifactVersion version = project.getArtifact().getSelectedVersion(); -// String versionString = "" + version.getMajorVersion() + "." + version.getMinorVersion() + "." + version.getIncrementalVersion(); -// if (version.getQualifier() != null) { -// versionString += "." + version.getQualifier(); -// } -// archive.addManifestEntry(Constants.BUNDLE_VERSION, versionString); -// archive.addManifestEntry(Constants.BUNDLE_MANIFESTVERSION, "2"); -// archive.addManifestEntry(Constants.BUNDLE_DESCRIPTION, project.getDescription()); -// // NB, no constant for this one -// archive.addManifestEntry("Bundle-License", ((License) project.getLicenses().get(0)).getUrl()); -// archive.addManifestEntry(Constants.BUNDLE_DOCURL, project.getUrl()); -// //TODO this might need some help -// archive.addManifestEntry(Constants.BUNDLE_SYMBOLICNAME, project.getArtifactId()); - - //include the feature.xml - Artifact featureArtifact = factory.createArtifactWithClassifier(groupId, artifactId, version, "xml", KarArtifactInstaller.FEATURE_CLASSIFIER); - jarArchiver.addFile(featuresFile, repositoryPath + layout.pathOf(featureArtifact)); - - if (featureArtifact.isSnapshot()) { - // the artifact is a snapshot, create the maven-metadata-local.xml - getLog().debug("Feature artifact is a SNAPSHOT, handling the maven-metadata-local.xml"); - File metadataTarget = new File(featuresFile.getParentFile(), "maven-metadata-local.xml"); - getLog().debug("Looking for " + metadataTarget.getAbsolutePath()); - if (!metadataTarget.exists()) { - // the maven-metadata-local.xml doesn't exist, create it - getLog().debug(metadataTarget.getAbsolutePath() + " doesn't exist, create it"); - Metadata metadata = new Metadata(); - metadata.setGroupId(featureArtifact.getGroupId()); - metadata.setArtifactId(featureArtifact.getArtifactId()); - metadata.setVersion(featureArtifact.getVersion()); - metadata.setModelVersion("1.1.0"); - - Versioning versioning = new Versioning(); - versioning.setLastUpdatedTimestamp(new Date(System.currentTimeMillis())); - Snapshot snapshot = new Snapshot(); - snapshot.setLocalCopy(true); - versioning.setSnapshot(snapshot); - SnapshotVersion snapshotVersion = new SnapshotVersion(); - snapshotVersion.setClassifier(featureArtifact.getClassifier()); - snapshotVersion.setVersion(featureArtifact.getVersion()); - snapshotVersion.setExtension(featureArtifact.getType()); - snapshotVersion.setUpdated(versioning.getLastUpdated()); - versioning.addSnapshotVersion(snapshotVersion); - - metadata.setVersioning(versioning); - - MetadataXpp3Writer metadataWriter = new MetadataXpp3Writer(); - try { - Writer writer = new FileWriter(metadataTarget); - metadataWriter.write(writer, metadata); - } catch (Exception e) { - getLog().warn("Could not create maven-metadata-local.xml", e); - getLog().warn("It means that this SNAPSHOT could be overwritten by an older one present on remote repositories"); - } - } - getLog().debug("Adding file " + metadataTarget.getAbsolutePath() + " in the jar path " + repositoryPath + layout.pathOf(featureArtifact).substring(0, layout.pathOf(featureArtifact).lastIndexOf('/')) + "/maven-metadata-local.xml"); - jarArchiver.addFile(metadataTarget, repositoryPath + layout.pathOf(featureArtifact).substring(0, layout.pathOf(featureArtifact).lastIndexOf('/')) + "/maven-metadata-local.xml"); - } - - for (Artifact artifact : bundles) { - artifactResolver.resolve(artifact, remoteRepos, localRepo); - - //TODO this may not be reasonable, but... resolved snapshot artifacts have timestamped versions - //which do not work in startup.properties. - artifact.setVersion(artifact.getBaseVersion()); - - if (artifact.isSnapshot()) { - // the artifact is a snapshot, create the maven-metadata-local.xml - final File metadataTmp = File.createTempFile("maven-metadata-local.xml", ".tmp"); - - try { - MavenUtil.generateMavenMetadata(artifact, metadataTmp); - } catch (Exception e) { - getLog().warn("Could not create maven-metadata-local.xml", e); - getLog().warn("It means that this SNAPSHOT could be overwritten by an older one present on remote repositories"); - } - - jarArchiver.addFile(metadataTmp, repositoryPath + layout.pathOf(artifact).substring(0, layout.pathOf(artifact).lastIndexOf('/')) + "/maven-metadata-local.xml"); - - try { - metadataTmp.delete(); - } catch (final Exception ex) { - getLog().warn("Cannot delete temporary created file.", ex); - } - } - - String targetFileName = repositoryPath + layout.pathOf(artifact); - jarArchiver.addFile(artifact.getFile(), targetFileName); - } - - if (resourcesDir.isDirectory()) { - archiver.getArchiver().addDirectory(resourcesDir); - } - archiver.createArchive(project, archive); - - return archiveFile; - } catch (Exception e) { - throw new MojoExecutionException("Failed to create archive", e); - } - } - - protected static boolean isMavenUrl(String name) { - Matcher m = mvnPattern.matcher(name); - return m.matches(); - } - - /** - * Return a path for an artifact: - * - if the input is already a path (doesn't contain ':'), the same path is returned. - * - if the input is a Maven URL, the input is converted to a default repository location path, type and classifier - * are optional. - * - * @param name artifact data - * @return path as supplied or a default Maven repository path - */ - private static String fromMaven(String name) { - Matcher m = mvnPattern.matcher(name); - if (!m.matches()) { - return name; - } - - StringBuilder b = new StringBuilder(); - b.append(m.group(1)); - for (int i = 0; i < b.length(); i++) { - if (b.charAt(i) == '.') { - b.setCharAt(i, '/'); - } - } - b.append("/"); // groupId - String artifactId = m.group(2); - String version = m.group(3); - String extension = m.group(5); - String classifier = m.group(7); - b.append(artifactId).append("/"); // artifactId - b.append(version).append("/"); // version - b.append(artifactId).append("-").append(version); - if (present(classifier)) { - b.append("-").append(classifier); - } - if (present(classifier)) { - b.append(".").append(extension); - } else { - b.append(".jar"); - } - return b.toString(); - } - - private static boolean present(String part) { - return part != null && !part.isEmpty(); - } - - protected static File getArchiveFile(final File basedir, final String finalName, String classifier) { - if (classifier == null) { - classifier = ""; - } else if (classifier.trim().length() > 0 && !classifier.startsWith("-")) { - classifier = "-" + classifier; - } - - return new File(basedir, finalName + classifier + ".kar"); - } - - -} diff --git a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/RunMojo.java b/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/RunMojo.java deleted file mode 100644 index 16023bfa1..000000000 --- a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/RunMojo.java +++ /dev/null @@ -1,304 +0,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. - */ -package org.apache.karaf.tooling; - -import org.apache.commons.compress.archivers.ArchiveEntry; -import org.apache.commons.compress.archivers.ArchiveInputStream; -import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; -import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream; -import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream; -import org.apache.commons.compress.utils.IOUtils; -import org.apache.commons.io.FileUtils; -import org.apache.karaf.features.BootFinished; -import org.apache.karaf.features.Feature; -import org.apache.karaf.features.FeaturesListener; -import org.apache.karaf.features.FeaturesService; -import org.apache.karaf.main.Main; -import org.apache.karaf.tooling.utils.MojoSupport; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.osgi.util.tracker.ServiceTracker; - -import java.io.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Run a Karaf instance - */ -@Mojo(name = "run", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = false) -public class RunMojo extends MojoSupport { - - /** - * Directory containing Karaf container base directory. - */ - @Parameter(defaultValue = "${project.build.directory}/karaf") - private File karafDirectory = null; - - /** - * Location where to download the Karaf distribution - */ - @Parameter(defaultValue = "mvn:org.apache.karaf/apache-karaf/LATEST/zip") - private String karafDistribution = null; - - /** - * Define if the project artifact should be deployed in the started container or not - */ - @Parameter(defaultValue = "true") - private boolean deployProjectArtifact = true; - - /** - * Define if the Karaf container keep running or stop just after the goal execution - */ - @Parameter(defaultValue = "true") - private boolean keepRunning = true; - - /** - * Define if the Karaf embedded sshd should be started or not - */ - @Parameter(defaultValue = "false") - private String startSsh = "false"; - - private static final Pattern mvnPattern = Pattern.compile("mvn:([^/ ]+)/([^/ ]+)/([^/ ]*)(/([^/ ]+)(/([^/ ]+))?)?"); - - public void execute() throws MojoExecutionException, MojoFailureException { - if (karafDirectory.exists()) { - getLog().info("Using Karaf container located " + karafDirectory.getAbsolutePath()); - } else { - getLog().info("Extracting Karaf container"); - try { - File karafArchiveFile = resolveFile(karafDistribution); - extract(karafArchiveFile, karafDirectory); - } catch (Exception e) { - throw new MojoFailureException("Can't extract Karaf container", e); - } - } - - getLog().info("Starting Karaf container"); - System.setProperty("karaf.home", karafDirectory.getAbsolutePath()); - System.setProperty("karaf.base", karafDirectory.getAbsolutePath()); - System.setProperty("karaf.data", karafDirectory.getAbsolutePath() + "/data"); - System.setProperty("karaf.etc", karafDirectory.getAbsolutePath() + "/etc"); - System.setProperty("karaf.instances", karafDirectory.getAbsolutePath() + "/instances"); - System.setProperty("karaf.startLocalConsole", "false"); - System.setProperty("karaf.startRemoteShell", startSsh); - System.setProperty("karaf.lock", "false"); - Main main = new Main(new String[0]); - try { - main.launch(); - while (main.getFramework().getState() != Bundle.ACTIVE) { - Thread.sleep(1000); - } - BundleContext bundleContext = main.getFramework().getBundleContext(); - Object bootFinished = null; - while (bootFinished == null) { - Thread.sleep(1000); - ServiceReference ref = bundleContext.getServiceReference(BootFinished.class); - if (ref != null) { - bootFinished = bundleContext.getService(ref); - } - } - deploy(bundleContext); - if (keepRunning) - main.awaitShutdown(); - main.destroy(); - } catch (Throwable e) { - throw new MojoExecutionException("Can't start container", e); - } finally { - System.gc(); - } - } - - private void deploy(BundleContext bundleContext) throws MojoExecutionException { - if (deployProjectArtifact) { - File artifact = project.getArtifact().getFile(); - if (artifact != null && artifact.exists()) { - if (project.getPackaging().equals("bundle")) { - try { - Bundle bundle = bundleContext.installBundle(artifact.toURI().toURL().toString()); - bundle.start(); - } catch (Exception e) { - throw new MojoExecutionException("Can't deploy project artifact in container", e); - } - } else { - throw new MojoExecutionException("Packaging " + project.getPackaging() + " is not supported"); - } - } else { - throw new MojoExecutionException("Project artifact doesn't exist"); - } - } - } - - public static void extract(File sourceFile, File targetFolder) throws IOException { - if (sourceFile.getAbsolutePath().indexOf(".zip") > 0) { - extractZipDistribution(sourceFile, targetFolder); - } else if (sourceFile.getAbsolutePath().indexOf(".tar.gz") > 0) { - extractTarGzDistribution(sourceFile, targetFolder); - } else { - throw new IllegalStateException("Unknown packaging of distribution; only zip or tar.gz could be handled."); - } - return; - } - - private static void extractTarGzDistribution(File sourceDistribution, File _targetFolder) - throws IOException { - File uncompressedFile = File.createTempFile("uncompressedTarGz-", ".tar"); - extractGzArchive(new FileInputStream(sourceDistribution), uncompressedFile); - extract(new TarArchiveInputStream(new FileInputStream(uncompressedFile)), _targetFolder); - FileUtils.forceDelete(uncompressedFile); - } - - private static void extractZipDistribution(File sourceDistribution, File _targetFolder) - throws IOException { - extract(new ZipArchiveInputStream(new FileInputStream(sourceDistribution)), _targetFolder); - } - - private static void extractGzArchive(InputStream tarGz, File tar) throws IOException { - BufferedInputStream in = new BufferedInputStream(tarGz); - FileOutputStream out = new FileOutputStream(tar); - GzipCompressorInputStream gzIn = new GzipCompressorInputStream(in); - final byte[] buffer = new byte[1000]; - int n = 0; - while (-1 != (n = gzIn.read(buffer))) { - out.write(buffer, 0, n); - } - out.close(); - gzIn.close(); - } - - private static void extract(ArchiveInputStream is, File targetDir) throws IOException { - try { - if (targetDir.exists()) { - FileUtils.forceDelete(targetDir); - } - targetDir.mkdirs(); - ArchiveEntry entry = is.getNextEntry(); - while (entry != null) { - String name = entry.getName(); - name = name.substring(name.indexOf("/") + 1); - File file = new File(targetDir, name); - if (entry.isDirectory()) { - file.mkdirs(); - } - else { - file.getParentFile().mkdirs(); - OutputStream os = new FileOutputStream(file); - try { - IOUtils.copy(is, os); - } - finally { - IOUtils.closeQuietly(os); - } - } - entry = is.getNextEntry(); - } - } - finally { - is.close(); - } - } - - protected static boolean isMavenUrl(String name) { - Matcher m = mvnPattern.matcher(name); - return m.matches(); - } - - private File resolveFile(String file) { - File fileResolved = null; - - if (isMavenUrl(file)) { - fileResolved = new File(fromMaven(file)); - try { - Artifact artifactTemp = resourceToArtifact(file, false); - if (!fileResolved.exists()) { - try { - artifactResolver.resolve(artifactTemp, remoteRepos, localRepo); - fileResolved = artifactTemp.getFile(); - } catch (ArtifactResolutionException e) { - getLog().error("Artifact was not resolved", e); - } catch (ArtifactNotFoundException e) { - getLog().error("Artifact was not found", e); - } - } - } catch (MojoExecutionException e) { - getLog().error(e); - } - } else { - fileResolved = new File(file); - } - - return fileResolved; - } - - /** - * Return a path for an artifact: - * - if the input is already a path (doesn't contain ':'), the same path is returned. - * - if the input is a Maven URL, the input is converted to a default repository location path, type and classifier - * are optional. - * - * @param name artifact data - * @return path as supplied or a default Maven repository path - */ - private static String fromMaven(String name) { - Matcher m = mvnPattern.matcher(name); - if (!m.matches()) { - return name; - } - - StringBuilder b = new StringBuilder(); - b.append(m.group(1)); - for (int i = 0; i < b.length(); i++) { - if (b.charAt(i) == '.') { - b.setCharAt(i, '/'); - } - } - b.append("/"); // groupId - String artifactId = m.group(2); - String version = m.group(3); - String extension = m.group(5); - String classifier = m.group(7); - b.append(artifactId).append("/"); // artifactId - b.append(version).append("/"); // version - b.append(artifactId).append("-").append(version); - if (present(classifier)) { - b.append("-").append(classifier); - } - if (present(classifier)) { - b.append(".").append(extension); - } else { - b.append(".jar"); - } - return b.toString(); - } - - private static boolean present(String part) { - return part != null && !part.isEmpty(); - } - -} diff --git a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java b/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java deleted file mode 100644 index 5d8c2a77c..000000000 --- a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java +++ /dev/null @@ -1,811 +0,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. - */ -package org.apache.karaf.tooling; - -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EnumSet; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.TreeSet; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.atomic.AtomicLong; -import java.util.jar.Attributes; -import java.util.jar.Manifest; -import java.util.regex.Pattern; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import aQute.bnd.osgi.Macro; -import aQute.bnd.osgi.Processor; -import org.apache.felix.resolver.Logger; -import org.apache.felix.resolver.ResolverImpl; -import org.apache.felix.utils.version.VersionRange; -import org.apache.felix.utils.version.VersionTable; -import org.apache.karaf.features.FeatureEvent; -import org.apache.karaf.features.FeaturesService; -import org.apache.karaf.features.internal.download.DownloadCallback; -import org.apache.karaf.features.internal.download.DownloadManager; -import org.apache.karaf.features.internal.download.Downloader; -import org.apache.karaf.features.internal.download.StreamProvider; -import org.apache.karaf.features.internal.model.Conditional; -import org.apache.karaf.features.internal.model.ConfigFile; -import org.apache.karaf.features.internal.model.Feature; -import org.apache.karaf.features.internal.model.Features; -import org.apache.karaf.features.internal.model.JaxbUtil; -import org.apache.karaf.features.internal.resolver.ResourceBuilder; -import org.apache.karaf.features.internal.resolver.ResourceImpl; -import org.apache.karaf.features.internal.resolver.ResourceUtils; -import org.apache.karaf.features.internal.service.Deployer; -import org.apache.karaf.features.internal.service.State; -import org.apache.karaf.features.internal.util.MapUtils; -import org.apache.karaf.features.internal.util.MultiException; -import org.apache.karaf.profile.assembly.CustomDownloadManager; -import org.apache.karaf.tooling.utils.MojoSupport; -import org.apache.karaf.util.config.PropertiesLoader; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.apache.maven.project.MavenProject; -import org.apache.maven.settings.Settings; -import org.ops4j.pax.url.mvn.MavenResolver; -import org.ops4j.pax.url.mvn.MavenResolvers; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleException; -import org.osgi.framework.Constants; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.Version; -import org.osgi.framework.namespace.IdentityNamespace; -import org.osgi.framework.startlevel.BundleStartLevel; -import org.osgi.framework.wiring.BundleCapability; -import org.osgi.framework.wiring.BundleRequirement; -import org.osgi.framework.wiring.BundleRevision; -import org.osgi.framework.wiring.BundleWiring; -import org.osgi.resource.Requirement; -import org.osgi.resource.Resource; -import org.osgi.resource.Wire; -import org.osgi.service.resolver.ResolutionException; - -import static java.util.jar.JarFile.MANIFEST_NAME; - -@Mojo(name = "verify", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true) -public class VerifyMojo extends MojoSupport { - - @Parameter(property = "descriptors") - protected Set descriptors; - - @Parameter(property = "features") - protected Set features; - - @Parameter(property = "framework") - protected Set framework; - - @Parameter(property = "configuration") - protected String configuration; - - @Parameter(property = "distribution", defaultValue = "org.apache.karaf:apache-karaf") - protected String distribution; - - @Parameter(property = "javase") - protected String javase; - - @Parameter(property = "dist-dir") - protected String distDir; - - @Parameter(property = "additional-metadata") - protected File additionalMetadata; - - @Parameter(property = "ignore-missing-conditions") - protected boolean ignoreMissingConditions; - - @Parameter(property = "fail") - protected String fail = "end"; - - @Parameter(property = "verify-transitive") - protected boolean verifyTransitive = false; - - @Parameter(defaultValue = "${project}", readonly = true) - protected MavenProject project; - - protected MavenResolver resolver; - - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - Hashtable config = new Hashtable<>(); - StringBuilder remote = new StringBuilder(); - for (Object obj : project.getRemoteProjectRepositories()) { - if (remote.length() > 0) { - remote.append(","); - } - remote.append(invoke(obj, "getUrl")); - remote.append("@id=").append(invoke(obj, "getId")); - if (!((Boolean) invoke(getPolicy(obj, false), "isEnabled"))) { - remote.append("@noreleases"); - } - if ((Boolean) invoke(getPolicy(obj, true), "isEnabled")) { - remote.append("@snapshots"); - } - } - getLog().info("Using repositories: " + remote.toString()); - config.put("maven.repositories", remote.toString()); - config.put("maven.localRepository", localRepo.getBasedir()); - config.put("maven.settings", mavenSession.getRequest().getUserSettingsFile().toString()); - // TODO: add more configuration bits ? - resolver = MavenResolvers.createMavenResolver(config, "maven"); - doExecute(); - } - - private Object invoke(Object object, String getter) throws MojoExecutionException { - try { - return object.getClass().getMethod(getter).invoke(object); - } catch (Exception e) { - throw new MojoExecutionException("Unable to build remote repository from " + object.toString(), e); - } - } - - private Object getPolicy(Object object, boolean snapshots) throws MojoExecutionException { - return invoke(object, "getPolicy", new Class[] { Boolean.TYPE }, new Object[] { snapshots }); - } - - private Object invoke(Object object, String getter, Class[] types, Object[] params) throws MojoExecutionException { - try { - return object.getClass().getMethod(getter, types).invoke(object, params); - } catch (Exception e) { - throw new MojoExecutionException("Unable to build remote repository from " + object.toString(), e); - } - } - - protected void doExecute() throws MojoExecutionException, MojoFailureException { - System.setProperty("karaf.home", "target/karaf"); - System.setProperty("karaf.data", "target/karaf/data"); - - Hashtable properties = new Hashtable<>(); - - if (additionalMetadata != null) { - try (Reader reader = new FileReader(additionalMetadata)) { - Properties metadata = new Properties(); - metadata.load(reader); - for (Enumeration e = metadata.propertyNames(); e.hasMoreElements(); ) { - Object key = e.nextElement(); - Object val = metadata.get(key); - properties.put(key.toString(), val.toString()); - } - } catch (IOException e) { - throw new MojoExecutionException("Unable to load additional metadata from " + additionalMetadata, e); - } - } - - // TODO: allow using external configuration ? - ScheduledExecutorService executor = Executors.newScheduledThreadPool(8); - DownloadManager manager = new CustomDownloadManager(resolver, executor); - final Map repositories; - Map> allFeatures = new HashMap<>(); - try { - repositories = loadRepositories(manager, descriptors); - for (String repoUri : repositories.keySet()) { - List features = repositories.get(repoUri).getFeature(); - // Ack features to inline configuration files urls - for (Feature feature : features) { - for (org.apache.karaf.features.internal.model.Bundle bi : feature.getBundle()) { - String loc = bi.getLocation(); - String nloc = null; - if (loc.contains("file:")) { - for (ConfigFile cfi : feature.getConfigfile()) { - if (cfi.getFinalname().substring(1) - .equals(loc.substring(loc.indexOf("file:") + "file:".length()))) { - nloc = cfi.getLocation(); - } - } - } - if (nloc != null) { - Field field = bi.getClass().getDeclaredField("location"); - field.setAccessible(true); - field.set(bi, loc.substring(0, loc.indexOf("file:")) + nloc); - } - } - } - allFeatures.put(repoUri, features); - } - } catch (Exception e) { - throw new MojoExecutionException("Unable to load features descriptors", e); - } - - List featuresToTest = new ArrayList<>(); - if (verifyTransitive) { - for (List features : allFeatures.values()) { - featuresToTest.addAll(features); - } - } else { - for (String uri : descriptors) { - featuresToTest.addAll(allFeatures.get(uri)); - } - } - if (features != null && !features.isEmpty()) { - StringBuilder sb = new StringBuilder(); - for (String feature : features) { - if (sb.length() > 0) { - sb.append("|"); - } - String p = feature.replaceAll("\\.", "\\\\.").replaceAll("\\*", ".*"); - sb.append(p); - if (!feature.contains("/")) { - sb.append("/.*"); - } - } - Pattern pattern = Pattern.compile(sb.toString()); - for (Iterator iterator = featuresToTest.iterator(); iterator.hasNext();) { - Feature feature = iterator.next(); - String id = feature.getName() + "/" + feature.getVersion(); - if (!pattern.matcher(id).matches()) { - iterator.remove(); - } - } - } - - for (String fmk : framework) { - properties.put("feature.framework." + fmk, fmk); - } - List failures = new ArrayList<>(); - for (Feature feature : featuresToTest) { - try { - String id = feature.getName() + "/" + feature.getVersion(); - verifyResolution(new CustomDownloadManager(resolver, executor), - repositories, Collections.singleton(id), properties); - getLog().info("Verification of feature " + id + " succeeded"); - } catch (Exception e) { - if (e.getCause() instanceof ResolutionException) { - getLog().warn(e.getMessage()); - } else { - getLog().warn(e); - } - failures.add(e); - if ("first".equals(fail)) { - throw e; - } - } - for (Conditional cond : feature.getConditional()) { - Set ids = new LinkedHashSet<>(); - ids.add(feature.getId()); - ids.addAll(cond.getCondition()); - try { - verifyResolution(manager, repositories, ids, properties); - getLog().info("Verification of feature " + ids + " succeeded"); - } catch (Exception e) { - if (ignoreMissingConditions && e.getCause() instanceof ResolutionException) { - boolean ignore = true; - Collection requirements = ((ResolutionException) e.getCause()).getUnresolvedRequirements(); - for (Requirement req : requirements) { - ignore &= (IdentityNamespace.IDENTITY_NAMESPACE.equals(req.getNamespace()) - && ResourceUtils.TYPE_FEATURE.equals(req.getAttributes().get("type")) - && cond.getCondition().contains(req.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE).toString())); - } - if (ignore) { - getLog().warn("Feature resolution failed for " + ids - + "\nMessage: " + e.getCause().getMessage()); - continue; - } - } - if (e.getCause() instanceof ResolutionException) { - getLog().warn(e.getMessage()); - } else { - getLog().warn(e); - } - failures.add(e); - if ("first".equals(fail)) { - throw e; - } - } - } - } - if ("end".equals(fail) && !failures.isEmpty()) { - throw new MojoExecutionException("Verification failures", new MultiException("Verification failures", failures)); - } - } - - private void verifyResolution(DownloadManager manager, final Map repositories, Set features, Hashtable properties) throws MojoExecutionException { - try { - Bundle systemBundle = getSystemBundle(getMetadata(properties, "metadata#")); - DummyDeployCallback callback = new DummyDeployCallback(systemBundle, repositories.values()); - Deployer deployer = new Deployer(manager, new ResolverImpl(new MavenResolverLog()), callback); - - - // Install framework - Deployer.DeploymentRequest request = createDeploymentRequest(); - - for (String fmwk : framework) { - MapUtils.addToMapSet(request.requirements, FeaturesService.ROOT_REGION, fmwk); - } - try { - deployer.deploy(callback.getDeploymentState(), request); - } catch (Exception e) { - throw new MojoExecutionException("Unable to resolve framework features", e); - } - - - /* - boolean resolveOptionalImports = getResolveOptionalImports(properties); - - DeploymentBuilder builder = new DeploymentBuilder( - manager, - null, - repositories.values(), - -1 // Disable url handlers - ); - Map downloadedResources = builder.download( - getPrefixedProperties(properties, "feature."), - getPrefixedProperties(properties, "bundle."), - getPrefixedProperties(properties, "fab."), - getPrefixedProperties(properties, "req."), - getPrefixedProperties(properties, "override."), - getPrefixedProperties(properties, "optional."), - getMetadata(properties, "metadata#") - ); - - for (String uri : getPrefixedProperties(properties, "resources.")) { - builder.addResourceRepository(new MetadataRepository(new HttpMetadataProvider(uri))); - } - */ - - - // Install features - for (String feature : features) { - MapUtils.addToMapSet(request.requirements, FeaturesService.ROOT_REGION, feature); - } - try { - Set prereqs = new HashSet<>(); - while (true) { - try { - deployer.deploy(callback.getDeploymentState(), request); - break; - } catch (Deployer.PartialDeploymentException e) { - if (!prereqs.containsAll(e.getMissing())) { - prereqs.addAll(e.getMissing()); - } else { - throw new Exception("Deployment aborted due to loop in missing prerequisites: " + e.getMissing()); - } - } - } - // TODO: find unused resources ? - } catch (Exception e) { - throw new MojoExecutionException("Feature resolution failed for " + features - + "\nMessage: " + e.getMessage() - + "\nRepositories: " + toString(new TreeSet<>(repositories.keySet())) - + "\nResources: " + toString(new TreeSet<>(manager.getProviders().keySet())), e); - } - - - } catch (MojoExecutionException e) { - throw e; - } catch (Exception e) { - throw new MojoExecutionException("Error verifying feature " + features + "\nMessage: " + e.getMessage(), e); - } - } - - private Deployer.DeploymentRequest createDeploymentRequest() { - Deployer.DeploymentRequest request = new Deployer.DeploymentRequest(); - request.bundleUpdateRange = FeaturesService.DEFAULT_BUNDLE_UPDATE_RANGE; - request.featureResolutionRange = FeaturesService.DEFAULT_FEATURE_RESOLUTION_RANGE; - request.serviceRequirements = FeaturesService.SERVICE_REQUIREMENTS_DEFAULT; - request.overrides = new HashSet<>(); - request.requirements = new HashMap<>(); - request.stateChanges = new HashMap<>(); - request.options = EnumSet.noneOf(FeaturesService.Option.class); - return request; - } - - private String toString(Collection collection) { - StringBuilder sb = new StringBuilder(); - sb.append("{\n"); - for (String s : collection) { - sb.append("\t").append(s).append("\n"); - } - sb.append("}"); - return sb.toString(); - } - - private Bundle getSystemBundle(Map>> metadata) throws Exception { - URL configPropURL; - if (configuration != null) { - configPropURL = new URL(configuration); - } else { - Artifact karafDistro = project.getArtifactMap().get(distribution); - if (karafDistro == null) { - throw new MojoFailureException("The karaf distribution " + distribution + " is not a dependency"); - } - if ("kar".equals(karafDistro.getType()) && distDir == null) { - distDir = "resources"; - } - String dir = distDir; - if (dir == null) { - dir = karafDistro.getArtifactId() + "-" + karafDistro.getBaseVersion(); - } - configPropURL = new URL("jar:file:" + karafDistro.getFile() + "!/" + dir + "/etc/config.properties"); - } - org.apache.felix.utils.properties.Properties configProps = PropertiesLoader.loadPropertiesFile(configPropURL, true); -// copySystemProperties(configProps); - if (javase == null) { - configProps.put("java.specification.version", System.getProperty("java.specification.version")); - } else { - configProps.put("java.specification.version", javase); - } - configProps.substitute(); - - Attributes attributes = new Attributes(); - attributes.putValue(Constants.BUNDLE_MANIFESTVERSION, "2"); - attributes.putValue(Constants.BUNDLE_SYMBOLICNAME, "system.bundle"); - attributes.putValue(Constants.BUNDLE_VERSION, "0.0.0"); - - String exportPackages = configProps.getProperty("org.osgi.framework.system.packages"); - if (configProps.containsKey("org.osgi.framework.system.packages.extra")) { - exportPackages += "," + configProps.getProperty("org.osgi.framework.system.packages.extra"); - } - exportPackages = exportPackages.replaceAll(",\\s*,", ","); - attributes.putValue(Constants.EXPORT_PACKAGE, exportPackages); - - String systemCaps = configProps.getProperty("org.osgi.framework.system.capabilities"); - attributes.putValue(Constants.PROVIDE_CAPABILITY, systemCaps); - - // TODO: support metadata overrides on system bundle -// attributes = DeploymentBuilder.overrideAttributes(attributes, metadata); - - final Hashtable headers = new Hashtable<>(); - for (Map.Entry attr : attributes.entrySet()) { - headers.put(attr.getKey().toString(), attr.getValue().toString()); - } - - final FakeBundleRevision resource = new FakeBundleRevision(headers, "system-bundle", 0l); - return resource.getBundle(); - } - - - public static Map loadRepositories(DownloadManager manager, Set uris) throws Exception { - final Map loaded = new HashMap<>(); - final Downloader downloader = manager.createDownloader(); - for (String repository : uris) { - downloader.download(repository, new DownloadCallback() { - @Override - public void downloaded(final StreamProvider provider) throws Exception { - try (InputStream is = provider.open()) { - Features featuresModel = JaxbUtil.unmarshal(provider.getUrl(), is, false); - synchronized (loaded) { - loaded.put(provider.getUrl(), featuresModel); - for (String innerRepository : featuresModel.getRepository()) { - downloader.download(innerRepository, this); - } - } - } - } - }); - } - downloader.await(); - return loaded; - } - - public static Set getPrefixedProperties(Map properties, String prefix) { - Set result = new HashSet<>(); - for (String key : properties.keySet()) { - if (key.startsWith(prefix)) { - String url = properties.get(key); - if (url == null || url.length() == 0) { - url = key.substring(prefix.length()); - } - if (!url.isEmpty()) { - result.add(url); - } - } - } - return result; - } - - public static Map>> getMetadata(Map properties, String prefix) { - Map>> result = new HashMap<>(); - for (String key : properties.keySet()) { - if (key.startsWith(prefix)) { - String val = properties.get(key); - key = key.substring(prefix.length()); - String[] parts = key.split("#"); - if (parts.length == 3) { - Map> ranges = result.get(parts[0]); - if (ranges == null) { - ranges = new HashMap<>(); - result.put(parts[0], ranges); - } - String version = parts[1]; - if (!version.startsWith("[") && !version.startsWith("(")) { - Processor processor = new Processor(); - processor.setProperty("@", VersionTable.getVersion(version).toString()); - Macro macro = new Macro(processor); - version = macro.process("${range;[==,=+)}"); - } - VersionRange range = new VersionRange(version); - Map hdrs = ranges.get(range); - if (hdrs == null) { - hdrs = new HashMap<>(); - ranges.put(range, hdrs); - } - hdrs.put(parts[2], val); - } - } - } - return result; - } - - public static class FakeBundleRevision extends ResourceImpl implements BundleRevision, BundleStartLevel { - - private final Bundle bundle; - private int startLevel; - - public FakeBundleRevision(final Hashtable headers, final String location, final long bundleId) throws BundleException { - ResourceBuilder.build(this, location, headers); - this.bundle = (Bundle) Proxy.newProxyInstance( - getClass().getClassLoader(), - new Class[] { Bundle.class }, - new InvocationHandler() { - @Override - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - if (method.getName().equals("hashCode")) { - return FakeBundleRevision.this.hashCode(); - } else if (method.getName().equals("equals")) { - return proxy == args[0]; - } else if (method.getName().equals("toString")) { - return bundle.getSymbolicName() + "/" + bundle.getVersion(); - } else if (method.getName().equals("adapt")) { - if (args.length == 1 && args[0] == BundleRevision.class) { - return FakeBundleRevision.this; - } else if (args.length == 1 && args[0] == BundleStartLevel.class) { - return FakeBundleRevision.this; - } - } else if (method.getName().equals("getHeaders")) { - return headers; - } else if (method.getName().equals("getBundleId")) { - return bundleId; - } else if (method.getName().equals("getLocation")) { - return location; - } else if (method.getName().equals("getSymbolicName")) { - String name = headers.get(Constants.BUNDLE_SYMBOLICNAME); - int idx = name.indexOf(';'); - if (idx > 0) { - name = name.substring(0, idx).trim(); - } - return name; - } else if (method.getName().equals("getVersion")) { - return new Version(headers.get(Constants.BUNDLE_VERSION)); - } else if (method.getName().equals("getState")) { - return Bundle.ACTIVE; - } else if (method.getName().equals("getLastModified")) { - return 0l; - } - return null; - } - }); - } - - @Override - public int getStartLevel() { - return startLevel; - } - - @Override - public void setStartLevel(int startLevel) { - this.startLevel = startLevel; - } - - @Override - public boolean isPersistentlyStarted() { - return true; - } - - @Override - public boolean isActivationPolicyUsed() { - return false; - } - - @Override - public String getSymbolicName() { - return bundle.getSymbolicName(); - } - - @Override - public Version getVersion() { - return bundle.getVersion(); - } - - @Override - public List getDeclaredCapabilities(String namespace) { - throw new UnsupportedOperationException(); - } - - @Override - public List getDeclaredRequirements(String namespace) { - throw new UnsupportedOperationException(); - } - - @Override - public int getTypes() { - throw new UnsupportedOperationException(); - } - - @Override - public BundleWiring getWiring() { - throw new UnsupportedOperationException(); - } - - @Override - public Bundle getBundle() { - return bundle; - } - } - - public static class DummyDeployCallback implements Deployer.DeployCallback { - - private final Bundle systemBundle; - private final Deployer.DeploymentState dstate; - private final AtomicLong nextBundleId = new AtomicLong(0); - - public DummyDeployCallback(Bundle sysBundle, Collection repositories) throws Exception { - systemBundle = sysBundle; - dstate = new Deployer.DeploymentState(); - dstate.bundles = new HashMap<>(); - dstate.features = new HashMap<>(); - dstate.bundlesPerRegion = new HashMap<>(); - dstate.filtersPerRegion = new HashMap<>(); - dstate.state = new State(); - - MapUtils.addToMapSet(dstate.bundlesPerRegion, FeaturesService.ROOT_REGION, 0l); - dstate.bundles.put(0l, systemBundle); - for (Features repo : repositories) { - for (Feature f : repo.getFeature()) { - dstate.features.put(f.getId(), f); - } - } - } - - public Deployer.DeploymentState getDeploymentState() { - return dstate; - } - - @Override - public void print(String message, boolean verbose) { - } - - @Override - public void saveState(State state) { - dstate.state.replace(state); - } - - @Override - public void persistResolveRequest(Deployer.DeploymentRequest request) throws IOException { - } - - @Override - public void installFeature(org.apache.karaf.features.Feature feature) throws IOException, InvalidSyntaxException { - } - - @Override - public void callListeners(FeatureEvent featureEvent) { - } - - @Override - public Bundle installBundle(String region, String uri, InputStream is) throws BundleException { - try { - Hashtable headers = new Hashtable<>(); - ZipInputStream zis = new ZipInputStream(is); - ZipEntry entry; - while ((entry = zis.getNextEntry()) != null) { - if (MANIFEST_NAME.equals(entry.getName())) { - Attributes attributes = new Manifest(zis).getMainAttributes(); - for (Map.Entry attr : attributes.entrySet()) { - headers.put(attr.getKey().toString(), attr.getValue().toString()); - } - } - } - BundleRevision revision = new FakeBundleRevision(headers, uri, nextBundleId.incrementAndGet()); - Bundle bundle = revision.getBundle(); - MapUtils.addToMapSet(dstate.bundlesPerRegion, region, bundle.getBundleId()); - dstate.bundles.put(bundle.getBundleId(), bundle); - return bundle; - } catch (IOException e) { - throw new BundleException("Unable to install bundle", e); - } - } - - @Override - public void updateBundle(Bundle bundle, String uri, InputStream is) throws BundleException { - throw new UnsupportedOperationException(); - } - - @Override - public void uninstall(Bundle bundle) throws BundleException { - throw new UnsupportedOperationException(); - } - - @Override - public void startBundle(Bundle bundle) throws BundleException { - } - - @Override - public void stopBundle(Bundle bundle, int options) throws BundleException { - } - - @Override - public void setBundleStartLevel(Bundle bundle, int startLevel) { - } - - @Override - public void refreshPackages(Collection bundles) throws InterruptedException { - } - - @Override - public void resolveBundles(Set bundles, Map> wiring, Map resToBnd) { - } - - @Override - public void replaceDigraph(Map>>> policies, Map> bundles) throws BundleException, InvalidSyntaxException { - } - } - - public class MavenResolverLog extends org.apache.felix.resolver.Logger { - - public MavenResolverLog() { - super(Logger.LOG_DEBUG); - } - - @Override - protected void doLog(int level, String msg, Throwable throwable) { - switch (level) { - case LOG_DEBUG: - getLog().debug(msg, throwable); - break; - case LOG_INFO: - getLog().info(msg, throwable); - break; - case LOG_WARNING: - getLog().warn(msg, throwable); - break; - case LOG_ERROR: - getLog().error(msg, throwable); - break; - } - } - } -} diff --git a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/client/ClientMojo.java b/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/client/ClientMojo.java deleted file mode 100644 index 930be6c52..000000000 --- a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/client/ClientMojo.java +++ /dev/null @@ -1,258 +0,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. - */ -package org.apache.karaf.tooling.client; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.apache.sshd.ClientChannel; -import org.apache.sshd.ClientSession; -import org.apache.sshd.SshClient; -import org.apache.sshd.agent.SshAgent; -import org.apache.sshd.agent.local.AgentImpl; -import org.apache.sshd.agent.local.LocalAgentFactory; -import org.apache.sshd.client.UserInteraction; -import org.apache.sshd.client.future.ConnectFuture; -import org.apache.sshd.common.RuntimeSshException; -import org.apache.sshd.common.keyprovider.FileKeyPairProvider; - -import org.fusesource.jansi.Ansi; -import org.fusesource.jansi.Ansi.Color; -import org.fusesource.jansi.AnsiConsole; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.Console; -import java.io.File; -import java.io.FileReader; -import java.io.IOError; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.net.URL; -import java.security.KeyPair; -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - * Client MOJO to deployWithSsh command on a running Karaf instance - */ -@Mojo(name = "client", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true) -public class ClientMojo extends AbstractMojo { - - @Parameter(defaultValue = "8101") - private int port; - - @Parameter(defaultValue = "localhost") - private String host; - - @Parameter(defaultValue = "karaf") - private String user; - - @Parameter(defaultValue = "karaf") - private String password; - - @Parameter(defaultValue = "0") - private int attempts; - - @Parameter(defaultValue = "2") - private int delay; - - @Parameter - private List commands; - - @Parameter - private List scripts; - - @Parameter - private File keyFile; - - private static final String NEW_LINE = System.getProperty("line.separator"); - - public void execute() throws MojoExecutionException { - // Add commands from scripts to already declared commands - if (scripts != null) { - for (File script : scripts) { - try (BufferedReader br = new BufferedReader(new FileReader(script))) { - String line; - while ((line = br.readLine()) != null) { - line = line.trim(); - if (line.isEmpty()) { - continue; - } - commands.add(line); - } - } catch (Exception e) { - throw new MojoExecutionException(e, e.getMessage(), e.toString()); - } - } - } - - if (commands == null || commands.isEmpty()) { - getLog().warn("No OSGi command was specified"); - return; - } - - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw, true); - for (String cmd : commands) { - getLog().info(cmd); - pw.println(cmd); - } - execute(sw.toString()); - } - - protected void execute(String cmd) throws MojoExecutionException { - SshClient client = null; - try { - final Console console = System.console(); - client = SshClient.setUpDefaultClient(); - setupAgent(user, keyFile, client); - - client.setUserInteraction( new UserInteraction() { - public void welcome(String banner) { - console.printf(banner); - } - - public String[] interactive(String destination, String name, String instruction, String[] prompt, boolean[] echo) - { - String[] answers = new String[prompt.length]; - try { - for (int i = 0; i < prompt.length; i++) { - if (console != null) { - if (echo[i]) { - answers[i] = console.readLine(prompt[i] + " "); - } - else { - answers[i] = new String( console.readPassword(prompt[i] + " ")); - } - } - } - } - catch (IOError e) { - } - return answers; - } - }); - client.start(); - if (console != null) { - console.printf("Logging in as %s\n", user); - } - ClientSession session = connect(client); - if (password != null) { - session.addPasswordIdentity(password); - } - session.auth().verify(); - - final ClientChannel channel = session.createChannel("exec", cmd.concat(NEW_LINE)); - channel.setIn(new ByteArrayInputStream(new byte[0])); - final ByteArrayOutputStream sout = new ByteArrayOutputStream(); - final ByteArrayOutputStream serr = new ByteArrayOutputStream(); - channel.setOut( AnsiConsole.wrapOutputStream(sout)); - channel.setErr( AnsiConsole.wrapOutputStream(serr)); - channel.open(); - channel.waitFor(ClientChannel.CLOSED, 0); - - sout.writeTo(System.out); - serr.writeTo(System.err); - - // Expects issue KARAF-2623 is fixed - final boolean isError = (channel.getExitStatus() != null && channel.getExitStatus().intValue() != 0); - if (isError) { - final String errorMarker = Ansi.ansi().fg(Color.RED).toString(); - final int fromIndex = sout.toString().indexOf(errorMarker) + errorMarker.length(); - final int toIndex = sout.toString().lastIndexOf(Ansi.ansi().fg(Color.DEFAULT ).toString()); - throw new MojoExecutionException(NEW_LINE + sout.toString().substring(fromIndex, toIndex)); - } - } - catch (MojoExecutionException e) { - throw e; - } - catch (Throwable t) { - throw new MojoExecutionException(t, t.getMessage(), t.toString()); - } - finally { - try { - client.stop(); - } - catch (Throwable t) { - throw new MojoExecutionException(t, t.getMessage(), t.toString()); - } - } - } - - private void setupAgent(String user, File keyFile, SshClient client) { - URL builtInPrivateKey = ClientMojo.class.getClassLoader().getResource("karaf.key"); - SshAgent agent = startAgent(user, builtInPrivateKey, keyFile); - client.setAgentFactory( new LocalAgentFactory(agent)); - client.getProperties().put(SshAgent.SSH_AUTHSOCKET_ENV_NAME, "local"); - } - - private SshAgent startAgent(String user, URL privateKeyUrl, File keyFile) { - try (InputStream is = privateKeyUrl.openStream()) - { - SshAgent agent = new AgentImpl(); - ObjectInputStream r = new ObjectInputStream(is); - KeyPair keyPair = (KeyPair) r.readObject(); - is.close(); - agent.addIdentity(keyPair, user); - if (keyFile != null) { - String[] keyFiles = new String[] { keyFile.getAbsolutePath() }; - FileKeyPairProvider fileKeyPairProvider = new FileKeyPairProvider(keyFiles); - for (KeyPair key : fileKeyPairProvider.loadKeys()) { - agent.addIdentity(key, user); - } - } - return agent; - } - catch (Throwable e) { - getLog().error("Error starting ssh agent for: " + e.getMessage(), e); - return null; - } - } - - private ClientSession connect(SshClient client) throws IOException, InterruptedException { - int retries = 0; - ClientSession session = null; - do { - final ConnectFuture future = client.connect(user, host, port); - future.await(); - try { - session = future.getSession(); - } - catch (RuntimeSshException ex) { - if (retries++ < attempts) { - Thread.sleep(TimeUnit.SECONDS.toMillis(delay)); - getLog().info("retrying (attempt " + retries + ") ..."); - } - else { - throw ex; - } - } - } while (session == null); - return session; - } - -} - diff --git a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/client/DeployMojo.java b/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/client/DeployMojo.java deleted file mode 100644 index 308ec0e5c..000000000 --- a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/client/DeployMojo.java +++ /dev/null @@ -1,283 +0,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. - */ -package org.apache.karaf.tooling.client; - -import org.apache.karaf.tooling.utils.MojoSupport; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.apache.sshd.ClientChannel; -import org.apache.sshd.ClientSession; -import org.apache.sshd.SshClient; -import org.apache.sshd.agent.SshAgent; -import org.apache.sshd.agent.local.AgentImpl; -import org.apache.sshd.agent.local.LocalAgentFactory; -import org.apache.sshd.client.UserInteraction; -import org.apache.sshd.client.future.ConnectFuture; -import org.apache.sshd.common.RuntimeSshException; -import org.apache.sshd.common.keyprovider.FileKeyPairProvider; - -import org.fusesource.jansi.Ansi; -import org.fusesource.jansi.Ansi.Color; -import org.fusesource.jansi.AnsiConsole; - -import javax.management.MBeanServerConnection; -import javax.management.ObjectName; -import javax.management.remote.JMXConnector; -import javax.management.remote.JMXConnectorFactory; -import javax.management.remote.JMXServiceURL; -import javax.management.remote.MBeanServerForwarder; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.Console; -import java.io.File; -import java.io.FileReader; -import java.io.IOError; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.net.URL; -import java.security.KeyPair; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - * Deploy MOJO to deploy an artifact remotely on a running Karaf instance, using ssh or JMX - */ -@Mojo(name = "deploy", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true) -public class DeployMojo extends MojoSupport { - - @Parameter(defaultValue = "8101") - private int port; - - @Parameter(defaultValue = "localhost") - private String host; - - @Parameter(defaultValue = "karaf") - private String user; - - @Parameter(defaultValue = "karaf") - private String password; - - @Parameter(defaultValue = "karaf-root") - private String instance = "karaf-root"; - - @Parameter(defaultValue = "0") - private int attempts; - - @Parameter(defaultValue = "2") - private int delay; - - @Parameter(defaultValue = "true") - private boolean useSsh = true; - - @Parameter(defaultValue = "true") - private boolean useProjectArtifact = true; - - @Parameter - List artifactLocations; - - @Parameter - private File keyFile; - - private static final String NEW_LINE = System.getProperty("line.separator"); - - public void execute() throws MojoExecutionException { - List artifacts = new ArrayList<>(); - if (useProjectArtifact) { - Artifact projectArtifact = project.getArtifact(); - artifacts.add("mvn:" + projectArtifact.getGroupId() + "/" + projectArtifact.getArtifactId() + "/" + projectArtifact.getVersion()); - } - artifacts.addAll(artifactLocations); - if (useSsh) - deployWithSsh(artifactLocations); - else deployWithJmx(artifactLocations); - } - - protected void deployWithJmx(List locations) throws MojoExecutionException { - try { - JMXServiceURL jmxServiceURL = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/" + instance); - ArrayList list = new ArrayList<>(); - if (user != null) - list.add(user); - if (password != null) - list.add(password); - HashMap env = new HashMap(); - String[] credentials = list.toArray(new String[list.size()]); - env.put(JMXConnector.CREDENTIALS, credentials); - JMXConnector jmxConnector = null; - if (credentials.length > 0) - jmxConnector = JMXConnectorFactory.connect(jmxServiceURL, env); - else jmxConnector = JMXConnectorFactory.connect(jmxServiceURL); - MBeanServerConnection mBeanServerConnection = jmxConnector.getMBeanServerConnection(); - for (String location : locations) { - mBeanServerConnection.invoke(new ObjectName("org.apache.karaf:type=bundle,name=*"), "install", new Object[]{ location, true }, new String[]{ "java.lang.String", "boolean" }); - } - } catch (Exception e) { - throw new MojoExecutionException("Can't deploy using JMX", e); - } - } - - protected void deployWithSsh(List locations) throws MojoExecutionException { - SshClient client = null; - try { - final Console console = System.console(); - client = SshClient.setUpDefaultClient(); - setupAgent(user, keyFile, client); - - client.setUserInteraction( new UserInteraction() { - public void welcome(String banner) { - console.printf(banner); - } - - public String[] interactive(String destination, String name, String instruction, String[] prompt, boolean[] echo) - { - String[] answers = new String[prompt.length]; - try { - for (int i = 0; i < prompt.length; i++) { - if (console != null) { - if (echo[i]) { - answers[i] = console.readLine(prompt[i] + " "); - } - else { - answers[i] = new String( console.readPassword(prompt[i] + " ")); - } - } - } - } - catch (IOError e) { - } - return answers; - } - }); - client.start(); - if (console != null) { - console.printf("Logging in as %s\n", user); - } - ClientSession session = connect(client); - if (password != null) { - session.addPasswordIdentity(password); - } - session.auth().verify(); - - StringWriter writer = new StringWriter(); - PrintWriter print = new PrintWriter(writer, true); - for (String location : locations) { - print.println("bundle:install -s " + location); - } - - final ClientChannel channel = session.createChannel("exec", print.toString().concat(NEW_LINE)); - channel.setIn(new ByteArrayInputStream(new byte[0])); - final ByteArrayOutputStream sout = new ByteArrayOutputStream(); - final ByteArrayOutputStream serr = new ByteArrayOutputStream(); - channel.setOut( AnsiConsole.wrapOutputStream(sout)); - channel.setErr( AnsiConsole.wrapOutputStream(serr)); - channel.open(); - channel.waitFor(ClientChannel.CLOSED, 0); - - sout.writeTo(System.out); - serr.writeTo(System.err); - - // Expects issue KARAF-2623 is fixed - final boolean isError = (channel.getExitStatus() != null && channel.getExitStatus().intValue() != 0); - if (isError) { - final String errorMarker = Ansi.ansi().fg(Color.RED).toString(); - final int fromIndex = sout.toString().indexOf(errorMarker) + errorMarker.length(); - final int toIndex = sout.toString().lastIndexOf(Ansi.ansi().fg(Color.DEFAULT ).toString()); - throw new MojoExecutionException(NEW_LINE + sout.toString().substring(fromIndex, toIndex)); - } - } - catch (MojoExecutionException e) { - throw e; - } - catch (Throwable t) { - throw new MojoExecutionException(t, t.getMessage(), t.toString()); - } - finally { - try { - client.stop(); - } - catch (Throwable t) { - throw new MojoExecutionException(t, t.getMessage(), t.toString()); - } - } - } - - private void setupAgent(String user, File keyFile, SshClient client) { - URL builtInPrivateKey = ClientMojo.class.getClassLoader().getResource("karaf.key"); - SshAgent agent = startAgent(user, builtInPrivateKey, keyFile); - client.setAgentFactory( new LocalAgentFactory(agent)); - client.getProperties().put(SshAgent.SSH_AUTHSOCKET_ENV_NAME, "local"); - } - - private SshAgent startAgent(String user, URL privateKeyUrl, File keyFile) { - try (InputStream is = privateKeyUrl.openStream()) - { - SshAgent agent = new AgentImpl(); - ObjectInputStream r = new ObjectInputStream(is); - KeyPair keyPair = (KeyPair) r.readObject(); - is.close(); - agent.addIdentity(keyPair, user); - if (keyFile != null) { - String[] keyFiles = new String[] { keyFile.getAbsolutePath() }; - FileKeyPairProvider fileKeyPairProvider = new FileKeyPairProvider(keyFiles); - for (KeyPair key : fileKeyPairProvider.loadKeys()) { - agent.addIdentity(key, user); - } - } - return agent; - } - catch (Throwable e) { - getLog().error("Error starting ssh agent for: " + e.getMessage(), e); - return null; - } - } - - private ClientSession connect(SshClient client) throws IOException, InterruptedException { - int retries = 0; - ClientSession session = null; - do { - final ConnectFuture future = client.connect(user, host, port); - future.await(); - try { - session = future.getSession(); - } - catch (RuntimeSshException ex) { - if (retries++ < attempts) { - Thread.sleep(TimeUnit.SECONDS.toMillis(delay)); - getLog().info("retrying (attempt " + retries + ") ..."); - } - else { - throw ex; - } - } - } while (session == null); - return session; - } - -} - diff --git a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/commands/AbstractCommandHelpPrinter.java b/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/commands/AbstractCommandHelpPrinter.java deleted file mode 100644 index dee1eb9f5..000000000 --- a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/commands/AbstractCommandHelpPrinter.java +++ /dev/null @@ -1,85 +0,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. - */ -package org.apache.karaf.tooling.commands; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; - -import org.apache.karaf.shell.api.action.Action; -import org.apache.karaf.shell.api.action.Argument; - -public abstract class AbstractCommandHelpPrinter implements CommandHelpPrinter { - - protected Argument replaceDefaultArgument(Field field, Argument argument) { - if (Argument.DEFAULT.equals(argument.name())) { - final Argument delegate = argument; - final String name = field.getName(); - argument = new Argument() { - public String name() { - return name; - } - - public String description() { - return delegate.description(); - } - - public boolean required() { - return delegate.required(); - } - - public int index() { - return delegate.index(); - } - - public boolean multiValued() { - return delegate.multiValued(); - } - - public String valueToShowInHelp() { - return delegate.valueToShowInHelp(); - } - - public Class annotationType() { - return delegate.annotationType(); - } - }; - } - return argument; - } - - protected Object getDefaultValue(Action action, Field field) { - try { - field.setAccessible(true); - return field.get(action); - } catch (Exception e) { - return null; - } - } - - protected String getDefaultValueString(Object o) { - if (o != null - && (!(o instanceof Boolean) || ((Boolean) o)) - && (!(o instanceof Number) || ((Number) o).doubleValue() != 0.0)) { - return o.toString(); - } else { - return null; - } - } - -} diff --git a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/commands/AsciiDoctorCommandHelpPrinter.java b/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/commands/AsciiDoctorCommandHelpPrinter.java deleted file mode 100644 index c2699b8f8..000000000 --- a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/commands/AsciiDoctorCommandHelpPrinter.java +++ /dev/null @@ -1,158 +0,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. - */ -package org.apache.karaf.tooling.commands; - -import org.apache.karaf.shell.api.action.Action; -import org.apache.karaf.shell.api.action.Argument; -import org.apache.karaf.shell.api.action.Command; -import org.apache.karaf.shell.api.action.Option; -import org.apache.karaf.shell.impl.action.command.HelpOption; - -import java.io.PrintStream; -import java.lang.reflect.Field; -import java.util.*; - -/** - * Prints documentation in asciidoc syntax - */ -public class AsciiDoctorCommandHelpPrinter extends AbstractCommandHelpPrinter { - - @Override - public void printHelp(Action action, PrintStream out, boolean includeHelpOption) { - Command command = action.getClass().getAnnotation(Command.class); - Set

"); - out.println(" " + command.scope() + ":" + command.name() + ""); - out.println("
"); - out.println(" Description"); - out.println(" "); - out.println(command.description()); - out.println(" "); - out.println("
"); - - StringBuffer syntax = new StringBuffer(); - syntax.append(String.format("%s:%s", command.scope(), command.name())); - if (options.size() > 0) { - syntax.append(" [options]"); - } - if (arguments.size() > 0) { - syntax.append(' '); - for (Argument argument : arguments) { - syntax.append(String.format(argument.required() ? "%s " : "[%s] ", argument.name())); - } - } - out.println("
"); - out.println(" Syntax"); - out.println(" "); - out.println(syntax.toString()); - out.println(" "); - out.println("
"); - - if (arguments.size() > 0) { - out.println("
"); - out.println(" Arguments"); - out.println(" "); - for (Argument argument : arguments) { - out.println(" "); - out.println(" " + argument.name() + ""); - String description = argument.description(); - if (!argument.required()) { - if (argument.valueToShowInHelp() != null && argument.valueToShowInHelp().length() != 0) { - if (Argument.DEFAULT_STRING.equals(argument.valueToShowInHelp())) { - Object o = getDefaultValue(action, argFields.get(argument)); - String defaultValue = getDefaultValueString(o); - if (defaultValue != null) { - description += " (defaults to " + o.toString() + ")"; - } - } - } - } - out.println(" " + description + ""); - out.println(" "); - } - - out.println(" "); - out.println("
"); - } - - if (options.size() > 0) { - out.println("
"); - out.println(" Options"); - out.println(" "); - - for (Option option : options) { - String opt = option.name(); - String description = option.description(); - for (String alias : option.aliases()) { - opt += ", " + alias; - } - Object o = getDefaultValue(action, optFields.get(option)); - String defaultValue = getDefaultValueString(o); - if (defaultValue != null) { - description += " (defaults to " + o.toString() + ")"; - } - out.println(" "); - out.println(" " + opt + ""); - out.println(" " + description + ""); - out.println(" "); - } - - out.println(" "); - out.println("
"); - } - - if (command.detailedDescription().length() > 0) { - out.println("
"); - out.println(" Details"); - out.println(" "); - out.println(command.detailedDescription()); - out.println(" "); - out.println("
"); - } - out.println("
"); - } - - @Override - public void printOverview(Map> commands, PrintStream writer) { - writer.println(""); - writer.println(" Commands"); - writer.println(" "); - for (String key : commands.keySet()) { - writer.println("
"); - writer.println(" " + key + ""); - for (String cmd : commands.get(key)) { - writer.println(" "); - } - writer.println("
"); - } - writer.println("
"); - } - -} diff --git a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/commands/GenerateHelpMojo.java b/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/commands/GenerateHelpMojo.java deleted file mode 100644 index c8a19d793..000000000 --- a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/commands/GenerateHelpMojo.java +++ /dev/null @@ -1,190 +0,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. - */ -package org.apache.karaf.tooling.commands; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.PrintStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; - -import org.apache.karaf.shell.api.action.Action; -import org.apache.karaf.shell.api.action.Command; -import org.apache.maven.artifact.DependencyResolutionRequiredException; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.apache.maven.project.MavenProject; -import org.apache.xbean.finder.ClassFinder; - -/** - * Generates help documentation for Karaf commands - */ -@Mojo(name = "commands-generate-help", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, - requiresDependencyResolution = ResolutionScope.RUNTIME, inheritByDefault = false, threadSafe = true) -public class GenerateHelpMojo extends AbstractMojo { - - /** - * The output folder - */ - @Parameter(defaultValue = "${project.build.directory}/docbkx/sources") - protected File targetFolder; - - /** - * The output format - */ - @Parameter(defaultValue = "docbx") - protected String format; - - /** - * The classloader to use for loading the commands. - * Can be "project" or "plugin" - */ - @Parameter(defaultValue = "project") - protected String classLoader; - - /** - * Includes the --help command output in the generated documentation - */ - @Parameter(defaultValue = "true") - protected boolean includeHelpOption; - - /** - * The maven project. - */ - @Parameter(defaultValue = "${project}") - protected MavenProject project; - - private static final String FORMAT_CONF = "conf"; - private static final String FORMAT_DOCBX = "docbx"; - private static final String FORMAT_ASCIIDOC = "asciidoc"; - - public void execute() throws MojoExecutionException, MojoFailureException { - try { - if (!FORMAT_DOCBX.equals(format) && !FORMAT_CONF.equals(format) && !FORMAT_ASCIIDOC.equals(format)) { - throw new MojoFailureException("Unsupported format: " + format + ". Supported formats are: asciidoc, docbx, or conf."); - } - if (!targetFolder.exists()) { - targetFolder.mkdirs(); - } - - ClassFinder finder = createFinder(classLoader); - List> classes = finder.findAnnotatedClasses(Command.class); - if (classes.isEmpty()) { - throw new MojoFailureException("No command found"); - } - - CommandHelpPrinter helpPrinter = null; - if (FORMAT_ASCIIDOC.equals(format)) { - helpPrinter = new AsciiDoctorCommandHelpPrinter(); - } - if (FORMAT_CONF.equals(format)) { - helpPrinter = new UserConfCommandHelpPrinter(); - } - if (FORMAT_DOCBX.equals(format)) { - helpPrinter = new DocBookCommandHelpPrinter(); - } - - Map> commands = new TreeMap>(); - - String commandSuffix = null; - if (FORMAT_ASCIIDOC.equals(format)) { - commandSuffix = "adoc"; - } - if (FORMAT_CONF.equals(format)) { - commandSuffix = "conf"; - } - if (FORMAT_DOCBX.equals(format)) { - commandSuffix = "xml"; - } - for (Class clazz : classes) { - try { - Action action = (Action) clazz.newInstance(); - Command cmd = clazz.getAnnotation(Command.class); - - // skip the *-help command - if (cmd.scope().equals("*")) continue; - - File output = new File(targetFolder, cmd.scope() + "-" + cmd.name() + "." + commandSuffix); - FileOutputStream outStream = new FileOutputStream(output); - PrintStream out = new PrintStream(outStream); - helpPrinter.printHelp(action, out, includeHelpOption); - out.close(); - outStream.close(); - - Set cmds = commands.get(cmd.scope()); - if (cmds == null) { - cmds = new TreeSet(); - commands.put(cmd.scope(), cmds); - } - cmds.add(cmd.name()); - getLog().info("Found command: " + cmd.scope() + ":" + cmd.name()); - } catch (Exception e) { - getLog().warn("Unable to write help for " + clazz.getName(), e); - } - } - - String overViewSuffix = null; - if (FORMAT_ASCIIDOC.equals(format)) { - overViewSuffix = "adoc"; - } - if (FORMAT_CONF.equals(format)) { - overViewSuffix = "conf"; - } - if (FORMAT_DOCBX.equals(format)) { - overViewSuffix = "xml"; - } - PrintStream writer = new PrintStream(new FileOutputStream(new File(targetFolder, "commands." + overViewSuffix))); - helpPrinter.printOverview(commands, writer); - writer.close(); - } catch (Exception e) { - throw new MojoExecutionException("Error building commands help", e); - } - } - - private ClassFinder createFinder(String classloaderType) throws DependencyResolutionRequiredException, MalformedURLException, - Exception, MojoFailureException { - ClassFinder finder; - if ("project".equals(classloaderType)) { - List urls = new ArrayList(); - for (Object object : project.getCompileClasspathElements()) { - String path = (String) object; - urls.add(new File(path).toURI().toURL()); - } - ClassLoader loader = new URLClassLoader(urls.toArray(new URL[urls.size()]), getClass().getClassLoader()); - finder = new ClassFinder(loader, urls); - } else if ("plugin".equals(classLoader)) { - finder = new ClassFinder(getClass().getClassLoader()); - } else { - throw new MojoFailureException("classLoader attribute must be 'project' or 'plugin'"); - } - return finder; - } - -} diff --git a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/commands/UserConfCommandHelpPrinter.java b/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/commands/UserConfCommandHelpPrinter.java deleted file mode 100644 index 669f5b272..000000000 --- a/karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/commands/UserConfCommandHelpPrinter.java +++ /dev/null @@ -1,150 +0,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. - */ -package org.apache.karaf.tooling.commands; - -import java.io.PrintStream; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.karaf.shell.api.action.Action; -import org.apache.karaf.shell.api.action.Argument; -import org.apache.karaf.shell.api.action.Command; -import org.apache.karaf.shell.api.action.Option; -import org.apache.karaf.shell.impl.action.command.HelpOption; - -/** - * Prints documentation in wiki syntax - */ -public class UserConfCommandHelpPrinter extends AbstractCommandHelpPrinter { - - @Override - public void printHelp(Action action, PrintStream out, boolean includeHelpOption) { - Command command = action.getClass().getAnnotation(Command.class); - Set