Repository: karaf
Updated Branches:
  refs/heads/master db76362b2 -> a8c8a7eac


KARAF-3968: add offline to the assembly mojo.


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/c3f7954a
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/c3f7954a
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/c3f7954a

Branch: refs/heads/master
Commit: c3f7954acc603ac94783240ca909ca0d07ed67ac
Parents: 0c322fa
Author: Benson Margulies <[email protected]>
Authored: Tue Sep 1 17:36:15 2015 -0400
Committer: Benson Margulies <[email protected]>
Committed: Tue Sep 1 17:36:15 2015 -0400

----------------------------------------------------------------------
 pom.xml                                         |  3 +-
 .../apache/karaf/profile/assembly/Builder.java  | 18 ++++-
 tooling/karaf-maven-plugin/pom.xml              | 14 +++-
 .../src/it/test-assembly/pom.xml                | 78 ++++++++++++++++++++
 .../org/apache/karaf/tooling/AssemblyMojo.java  |  1 +
 .../src/test/offline.properties                 | 15 ++++
 6 files changed, 125 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/c3f7954a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0b09a79..367011c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2086,7 +2086,8 @@
         <profile>
             <id>fastinstall</id>
             <properties>
-                <maven.test.skip>true</maven.test.skip>
+              <maven.test.skip>true</maven.test.skip>
+              <invoker.skip>true</invoker.skip>
             </properties>
         </profile>
         <profile>

http://git-wip-us.apache.org/repos/asf/karaf/blob/c3f7954a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
----------------------------------------------------------------------
diff --git 
a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java 
b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
index f5b69d4..68e41f8 100644
--- a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
+++ b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
@@ -101,6 +101,7 @@ public class Builder {
     private static final String LIBRARY_CLAUSE_TYPE = "type";
     private static final String LIBRARY_CLAUSE_EXPORT = "export";
     private static final String LIBRARY_CLAUSE_DELEGATE = "delegate";
+    public static final String ORG_OPS4J_PAX_URL_MVN_PID = 
"org.ops4j.pax.url.mvn";
 
     public static enum Stage {
         Startup, Boot, Installed
@@ -145,6 +146,7 @@ public class Builder {
     boolean ignoreDependencyFlag;
     int defaultStartLevel = 50;
     Path homeDirectory;
+    boolean offline;
 
     private ScheduledExecutorService executor;
     private DownloadManager manager;
@@ -295,6 +297,15 @@ public class Builder {
         return this;
     }
 
+    public Builder offline(boolean offline) {
+        this.offline = offline;
+        return this;
+    }
+
+    public Builder offline() {
+        return offline(true);
+    }
+
     public Builder staticFramework() {
         // TODO: load this from resources
         return staticFramework("4.0.0-SNAPSHOT");
@@ -367,7 +378,10 @@ public class Builder {
         // Create download manager
         //
         Dictionary<String, String> props = new Hashtable<>();
-        MavenResolver resolver = MavenResolvers.createMavenResolver(props, 
"org.ops4j.pax.url.mvn");
+        if (offline) {
+            props.put(ORG_OPS4J_PAX_URL_MVN_PID + "offline", "true");
+        }
+        MavenResolver resolver = MavenResolvers.createMavenResolver(props, 
ORG_OPS4J_PAX_URL_MVN_PID);
         executor = Executors.newScheduledThreadPool(8);
         manager = new CustomDownloadManager(resolver, executor);
         this.resolver = new ResolverImpl(new Slf4jResolverLog(LOGGER));
@@ -462,7 +476,7 @@ public class Builder {
 
         manager = new CustomDownloadManager(resolver, executor, 
overallEffective);
 
-        Hashtable<String, String> agentProps = new 
Hashtable<>(overallEffective.getConfiguration("org.ops4j.pax.url.mvn"));
+        Hashtable<String, String> agentProps = new 
Hashtable<>(overallEffective.getConfiguration(ORG_OPS4J_PAX_URL_MVN_PID));
         final Map<String, String> properties = new HashMap<>();
         properties.put("karaf.default.repository", "system");
         InterpolationHelper.performSubstitution(agentProps, new 
InterpolationHelper.SubstitutionCallback() {

http://git-wip-us.apache.org/repos/asf/karaf/blob/c3f7954a/tooling/karaf-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/pom.xml 
b/tooling/karaf-maven-plugin/pom.xml
index ee297f2..9aa63d4 100644
--- a/tooling/karaf-maven-plugin/pom.xml
+++ b/tooling/karaf-maven-plugin/pom.xml
@@ -204,7 +204,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-invoker-plugin</artifactId>
-                <version>1.6</version>
+                <version>2.0.0</version>
                 <configuration>
                     <debug>true</debug>
                     <projectsDirectory>src/it</projectsDirectory>
@@ -230,6 +230,18 @@
                             <goal>run</goal>
                         </goals>
                     </execution>
+                    <execution>
+                        <id>test-offline</id>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            
<invokerPropertiesFile>src/test/offline.properties</invokerPropertiesFile>
+                            <pomExcludes>
+                                
<pomExclude>test-check-dependencies-failure/pom.xml</pomExclude>
+                            </pomExcludes>
+                        </configuration>
+                    </execution>
                 </executions>
                 <dependencies>
                     <dependency>

http://git-wip-us.apache.org/repos/asf/karaf/blob/c3f7954a/tooling/karaf-maven-plugin/src/it/test-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-assembly/pom.xml 
b/tooling/karaf-maven-plugin/src/it/test-assembly/pom.xml
new file mode 100644
index 0000000..3444f41
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-assembly/pom.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";
+         xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>test</groupId>
+    <artifactId>test-basic-generation</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>karaf-assembly</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.karaf.features</groupId>
+            <artifactId>framework</artifactId>
+            <version>@pom.version@</version>
+            <type>kar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.features</groupId>
+            <artifactId>standard</artifactId>
+            <version>@pom.version@</version>
+            <classifier>features</classifier>
+            <type>xml</type>
+            <scope>runtime</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <version>@pom.version@</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <finalName>${project.artifactId}</finalName>
+                    <bootFeatures>
+                        <feature>bundle</feature>
+                        <feature>config</feature>
+                        <feature>diagnostic</feature>
+                        <feature>feature</feature>
+                        <feature>jaas</feature>
+                        <feature>shell</feature>
+                        <feature>log</feature>
+                        <feature>management</feature>
+                        <feature>package</feature>
+                        <feature>shell-compat</feature>
+                        <feature>ssh</feature>
+                        <feature>system</feature>
+                        <feature>wrap</feature>
+                    </bootFeatures>
+                    <archiveZip>false</archiveZip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/karaf/blob/c3f7954a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
----------------------------------------------------------------------
diff --git 
a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
 
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
index f2bb10f..e530bc9 100644
--- 
a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
+++ 
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
@@ -204,6 +204,7 @@ public class AssemblyMojo extends MojoSupport {
         }
 
         Builder builder = Builder.newInstance();
+        builder.offline(mavenSession.isOffline());
 
         // Set up blacklisted items
         builder.blacklistBundles(blacklistedBundles);

http://git-wip-us.apache.org/repos/asf/karaf/blob/c3f7954a/tooling/karaf-maven-plugin/src/test/offline.properties
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/test/offline.properties 
b/tooling/karaf-maven-plugin/src/test/offline.properties
new file mode 100644
index 0000000..73da0c2
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/test/offline.properties
@@ -0,0 +1,15 @@
+#    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.offline = true

Reply via email to