maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject [maven-jdeps-plugin] branch master updated: [MJDEPS-12] Add support for the '-package' options
Date Sat, 24 Feb 2018 10:53:23 GMT
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jdeps-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 98dd93b  [MJDEPS-12] Add support for the '-package' options
98dd93b is described below

commit 98dd93b9a22d45194d5d7b09ce4bbd25c219bb80
Author: rfscholte <rfscholte@apache.org>
AuthorDate: Sat Feb 24 11:53:14 2018 +0100

    [MJDEPS-12] Add support for the '-package' options
---
 src/it/package/invoker.properties                  | 19 +++++++
 src/it/package/pom.xml                             | 58 ++++++++++++++++++++++
 .../org/apache/maven/plugins/jdeps/its/Main.java   | 28 +++++++++++
 src/it/package/verify.groovy                       | 23 +++++++++
 .../maven/plugin/jdeps/AbstractJDepsMojo.java      | 18 +++++++
 5 files changed, 146 insertions(+)

diff --git a/src/it/package/invoker.properties b/src/it/package/invoker.properties
new file mode 100644
index 0000000..9dc2e74
--- /dev/null
+++ b/src/it/package/invoker.properties
@@ -0,0 +1,19 @@
+# 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.java.version=1.8+
+invoker.goals=process-classes
diff --git a/src/it/package/pom.xml b/src/it/package/pom.xml
new file mode 100644
index 0000000..674f7d7
--- /dev/null
+++ b/src/it/package/pom.xml
@@ -0,0 +1,58 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  
+  <groupId>org.apache.maven.plugins.jdeps.its</groupId>
+  <artifactId>package</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  
+  <url>https://issues.apache.org/jira/browse/MJDEPS-12</url>
+  
+  <properties>
+    <maven.compiler.source>1.6</maven.compiler.source>
+    <maven.compiler.target>1.6</maven.compiler.target>
+  </properties>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>@project.groupId@</groupId>
+        <artifactId>@project.artifactId@</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>jdkinternals</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <packages>
+            <package>java.io</package>
+          </packages>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/src/it/package/src/main/java/org/apache/maven/plugins/jdeps/its/Main.java b/src/it/package/src/main/java/org/apache/maven/plugins/jdeps/its/Main.java
new file mode 100644
index 0000000..221ec9c
--- /dev/null
+++ b/src/it/package/src/main/java/org/apache/maven/plugins/jdeps/its/Main.java
@@ -0,0 +1,28 @@
+package org.apache.maven.plugins.jdeps.its;
+
+/*
+ * 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.
+ */
+
+public class Main
+{
+   public static void main( String[] args )
+   {
+     System.out.println( "Hello World!" ); 
+   }    
+}
\ No newline at end of file
diff --git a/src/it/package/verify.groovy b/src/it/package/verify.groovy
new file mode 100644
index 0000000..16a77db
--- /dev/null
+++ b/src/it/package/verify.groovy
@@ -0,0 +1,23 @@
+
+/*
+ * 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.
+ */
+ 
+def buildLog = new File( basedir, 'build.log' )
+
+assert 1 == buildLog.readLines().dropWhile{ it != 'classes -> java.base' }.drop(1).takeWhile{
!it.startsWith( '[INFO]' ) }.size()
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java b/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java
index 6d61594..4aaa548 100644
--- a/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java
+++ b/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java
@@ -140,6 +140,15 @@ public abstract class AbstractJDepsMojo
     @Parameter( property = "jdeps.verbose" )
     private String verbose;
 
+    
+    /**
+     * Finds dependences matching the specified package name.
+     * 
+     * @since 3.1.1.
+     */
+    @Parameter
+    private List<String> packages;
+
 //    /**
 //     * A comma-separated list to find dependences in the given package (may be given multiple
times)
 //     */
@@ -301,6 +310,15 @@ public abstract class AbstractJDepsMojo
             throw new MojoFailureException( e.getMessage(), e );
         }
         
+        if ( packages != null )
+        {
+            for ( String pkgName : packages )
+            {
+                cmd.createArg().setValue( "-p" );
+                cmd.createArg().setValue( pkgName );
+            }
+        }
+        
 //        if ( packageNames != null )
 //        {
 //            for ( String pkgName : packageNames.split( "[,:;]" ) )

-- 
To stop receiving notification emails like this one, please contact
rfscholte@apache.org.

Mime
View raw message