Initial commit maven-jdeprscan-plugin

git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1812175 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..fedf1c2
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,124 @@
+<?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>

+

+  <parent>

+    <groupId>org.apache.maven.plugins</groupId>

+    <artifactId>maven-plugins</artifactId>

+    <version>28</version>

+    <relativePath>../../pom/maven/maven-plugins/pom.xml</relativePath>

+  </parent>

+

+  <artifactId>maven-jdeprscan-plugin</artifactId>

+  <version>3.0.0-SNAPSHOT</version>

+  <packaging>maven-plugin</packaging>

+

+  <name>Apache Maven JDeprScan Plugin</name>

+  <description>The JDeprScan Plugin uses the jdeprscan tool that scans classes for uses of deprecated API elements.</description>

+  <inceptionYear>2017</inceptionYear>

+

+  <prerequisites>

+    <maven>${mavenVersion}</maven>

+  </prerequisites>

+  

+  <scm>

+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-jdeprscan-plugin</connection>

+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-jdeprscan-plugin</developerConnection>

+    <url>http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jdeprscan-plugin</url>

+  </scm>

+  <issueManagement>

+    <system>JIRA</system>

+    <url>https://issues.apache.org/jira/browse/MJDEPRSCAN</url>

+  </issueManagement>

+  <distributionManagement>

+    <site>

+      <id>apache.website</id>

+      <url>scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/components/${maven.site.path}</url>

+    </site>

+  </distributionManagement>

+

+  <properties>

+    <mavenVersion>3.0</mavenVersion>

+    <javaVersion>7</javaVersion>

+  </properties>

+  

+  <dependencies>

+    <dependency>

+      <groupId>org.apache.maven.plugin-tools</groupId>

+      <artifactId>maven-plugin-annotations</artifactId>

+      <scope>provided</scope>

+    </dependency>

+    <!-- Maven -->

+    <dependency>

+      <groupId>org.apache.maven</groupId>

+      <artifactId>maven-plugin-api</artifactId>

+      <version>${mavenVersion}</version>

+    </dependency>

+    <dependency>

+      <groupId>org.apache.maven</groupId>

+      <artifactId>maven-core</artifactId>

+      <version>${mavenVersion}</version>

+    </dependency>

+    <dependency>

+      <groupId>org.apache.maven</groupId>

+      <artifactId>maven-model</artifactId>

+      <version>${mavenVersion}</version>

+    </dependency>

+    <dependency>

+      <groupId>org.codehaus.plexus</groupId>

+      <artifactId>plexus-utils</artifactId>

+      <version>3.1.0</version>

+    </dependency>

+    <dependency>

+      <groupId>org.apache.commons</groupId>

+      <artifactId>commons-lang3</artifactId>

+      <version>3.5</version>

+    </dependency>

+    

+    <!-- TEST -->

+    <dependency>

+      <groupId>junit</groupId>

+      <artifactId>junit</artifactId>

+      <version>4.11</version>

+      <scope>test</scope>

+    </dependency>

+  </dependencies>

+  

+  <profiles>

+    <profile>

+      <id>run-its</id>

+      <build>

+        <plugins>

+          <plugin>

+            <groupId>org.apache.maven.plugins</groupId>

+            <artifactId>maven-invoker-plugin</artifactId>

+            <configuration>

+              <projectsDirectory>src/it/projects</projectsDirectory>

+              <pomIncludes>*</pomIncludes>

+            </configuration>

+          </plugin>

+        </plugins>

+      </build>

+    </profile>

+  </profiles>

+</project>

diff --git a/src/it/projects/jdeprscan-default/invoker.properties b/src/it/projects/jdeprscan-default/invoker.properties
new file mode 100644
index 0000000..cb52a4c
--- /dev/null
+++ b/src/it/projects/jdeprscan-default/invoker.properties
@@ -0,0 +1,17 @@
+# 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.goals = verify
\ No newline at end of file
diff --git a/src/it/projects/jdeprscan-default/pom.xml b/src/it/projects/jdeprscan-default/pom.xml
new file mode 100644
index 0000000..6f58138
--- /dev/null
+++ b/src/it/projects/jdeprscan-default/pom.xml
@@ -0,0 +1,45 @@
+<?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.jdeprscan.its</groupId>

+  <artifactId>jdeprscan-default</artifactId>

+  <version>1.0.0-SNAPSHOT</version>

+

+  <build>

+    <plugins>

+      <plugin>

+        <groupId>org.apache.maven.plugins</groupId>

+        <artifactId>maven-jdeprscan-plugin</artifactId>

+        <version>@project.version@</version>

+        <executions>

+          <execution>

+            <goals>

+              <goal>jdeprscan</goal>

+            </goals>

+          </execution>

+        </executions>

+      </plugin>

+    </plugins>

+  </build>

+</project>

diff --git a/src/it/projects/jdeprscan-default/src/main/java/o/a/m/p/j/its/Main.java b/src/it/projects/jdeprscan-default/src/main/java/o/a/m/p/j/its/Main.java
new file mode 100644
index 0000000..f842035
--- /dev/null
+++ b/src/it/projects/jdeprscan-default/src/main/java/o/a/m/p/j/its/Main.java
@@ -0,0 +1,32 @@
+package o.a.m.p.j.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 )

+    {

+        for( String arg : args )

+        {

+          System.out.println( arg ); 

+        }

+    }

+        

+}
\ No newline at end of file
diff --git a/src/it/projects/jdeprscan-empty/pom.xml b/src/it/projects/jdeprscan-empty/pom.xml
new file mode 100644
index 0000000..6f58138
--- /dev/null
+++ b/src/it/projects/jdeprscan-empty/pom.xml
@@ -0,0 +1,45 @@
+<?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.jdeprscan.its</groupId>

+  <artifactId>jdeprscan-default</artifactId>

+  <version>1.0.0-SNAPSHOT</version>

+

+  <build>

+    <plugins>

+      <plugin>

+        <groupId>org.apache.maven.plugins</groupId>

+        <artifactId>maven-jdeprscan-plugin</artifactId>

+        <version>@project.version@</version>

+        <executions>

+          <execution>

+            <goals>

+              <goal>jdeprscan</goal>

+            </goals>

+          </execution>

+        </executions>

+      </plugin>

+    </plugins>

+  </build>

+</project>

diff --git a/src/it/projects/jdeprscan-release7/invoker.properties b/src/it/projects/jdeprscan-release7/invoker.properties
new file mode 100644
index 0000000..cb52a4c
--- /dev/null
+++ b/src/it/projects/jdeprscan-release7/invoker.properties
@@ -0,0 +1,17 @@
+# 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.goals = verify
\ No newline at end of file
diff --git a/src/it/projects/jdeprscan-release7/pom.xml b/src/it/projects/jdeprscan-release7/pom.xml
new file mode 100644
index 0000000..e4a723e
--- /dev/null
+++ b/src/it/projects/jdeprscan-release7/pom.xml
@@ -0,0 +1,48 @@
+<?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.jdeprscan.its</groupId>

+  <artifactId>jdeprscan-release7</artifactId>

+  <version>1.0.0-SNAPSHOT</version>

+

+  <build>

+    <plugins>

+      <plugin>

+        <groupId>org.apache.maven.plugins</groupId>

+        <artifactId>maven-jdeprscan-plugin</artifactId>

+        <version>@project.version@</version>

+        <executions>

+          <execution>

+            <goals>

+              <goal>jdeprscan</goal>

+            </goals>

+          </execution>

+        </executions>

+        <configuration>

+          <release>7</release>

+        </configuration>

+      </plugin>

+    </plugins>

+  </build>

+</project>

diff --git a/src/it/projects/jdeprscan-release7/src/main/java/o/a/m/p/j/its/Deprecations.java b/src/it/projects/jdeprscan-release7/src/main/java/o/a/m/p/j/its/Deprecations.java
new file mode 100644
index 0000000..373dd32
--- /dev/null
+++ b/src/it/projects/jdeprscan-release7/src/main/java/o/a/m/p/j/its/Deprecations.java
@@ -0,0 +1,29 @@
+package o.a.m.p.j.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.

+ */

+ 

+import java.rmi.RMISecurityManager;

+

+public class Deprecations {

+  

+   SecurityManager sm = new RMISecurityManager();    // deprecated in 8

+    

+   Boolean b2 = new Boolean(true);          // deprecated in 9          

+}
\ No newline at end of file
diff --git a/src/it/projects/jdeprscan-release7/verify.groovy b/src/it/projects/jdeprscan-release7/verify.groovy
new file mode 100644
index 0000000..78a0e4a
--- /dev/null
+++ b/src/it/projects/jdeprscan-release7/verify.groovy
@@ -0,0 +1,26 @@
+/*

+ * 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 !buildLog.text.contains( "class o/a/m/p/j/its/Deprecations uses deprecated class java/rmi/RMISecurityManager" )

+assert !buildLog.text.contains( "class o/a/m/p/j/its/Deprecations uses deprecated method java/lang/Boolean::<init>(Z)V" )

+ 

+

+

diff --git a/src/it/projects/jdeprscan-release8/invoker.properties b/src/it/projects/jdeprscan-release8/invoker.properties
new file mode 100644
index 0000000..cb52a4c
--- /dev/null
+++ b/src/it/projects/jdeprscan-release8/invoker.properties
@@ -0,0 +1,17 @@
+# 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.goals = verify
\ No newline at end of file
diff --git a/src/it/projects/jdeprscan-release8/pom.xml b/src/it/projects/jdeprscan-release8/pom.xml
new file mode 100644
index 0000000..63cc5ce
--- /dev/null
+++ b/src/it/projects/jdeprscan-release8/pom.xml
@@ -0,0 +1,48 @@
+<?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.jdeprscan.its</groupId>

+  <artifactId>jdeprscan-release8</artifactId>

+  <version>1.0.0-SNAPSHOT</version>

+

+  <build>

+    <plugins>

+      <plugin>

+        <groupId>org.apache.maven.plugins</groupId>

+        <artifactId>maven-jdeprscan-plugin</artifactId>

+        <version>@project.version@</version>

+        <executions>

+          <execution>

+            <goals>

+              <goal>jdeprscan</goal>

+            </goals>

+          </execution>

+        </executions>

+        <configuration>

+          <release>8</release>

+        </configuration>

+      </plugin>

+    </plugins>

+  </build>

+</project>

diff --git a/src/it/projects/jdeprscan-release8/src/main/java/o/a/m/p/j/its/Deprecations.java b/src/it/projects/jdeprscan-release8/src/main/java/o/a/m/p/j/its/Deprecations.java
new file mode 100644
index 0000000..373dd32
--- /dev/null
+++ b/src/it/projects/jdeprscan-release8/src/main/java/o/a/m/p/j/its/Deprecations.java
@@ -0,0 +1,29 @@
+package o.a.m.p.j.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.

+ */

+ 

+import java.rmi.RMISecurityManager;

+

+public class Deprecations {

+  

+   SecurityManager sm = new RMISecurityManager();    // deprecated in 8

+    

+   Boolean b2 = new Boolean(true);          // deprecated in 9          

+}
\ No newline at end of file
diff --git a/src/it/projects/jdeprscan-release8/verify.groovy b/src/it/projects/jdeprscan-release8/verify.groovy
new file mode 100644
index 0000000..908cb94
--- /dev/null
+++ b/src/it/projects/jdeprscan-release8/verify.groovy
@@ -0,0 +1,26 @@
+/*

+ * 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 buildLog.text.contains( "class o/a/m/p/j/its/Deprecations uses deprecated class java/rmi/RMISecurityManager" )

+assert !buildLog.text.contains( "class o/a/m/p/j/its/Deprecations uses deprecated method java/lang/Boolean::<init>(Z)V" )

+ 

+

+

diff --git a/src/it/projects/jdeprscan-release9/invoker.properties b/src/it/projects/jdeprscan-release9/invoker.properties
new file mode 100644
index 0000000..cb52a4c
--- /dev/null
+++ b/src/it/projects/jdeprscan-release9/invoker.properties
@@ -0,0 +1,17 @@
+# 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.goals = verify
\ No newline at end of file
diff --git a/src/it/projects/jdeprscan-release9/pom.xml b/src/it/projects/jdeprscan-release9/pom.xml
new file mode 100644
index 0000000..276389d
--- /dev/null
+++ b/src/it/projects/jdeprscan-release9/pom.xml
@@ -0,0 +1,48 @@
+<?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.jdeprscan.its</groupId>

+  <artifactId>jdeprscan-release9</artifactId>

+  <version>1.0.0-SNAPSHOT</version>

+

+  <build>

+    <plugins>

+      <plugin>

+        <groupId>org.apache.maven.plugins</groupId>

+        <artifactId>maven-jdeprscan-plugin</artifactId>

+        <version>@project.version@</version>

+        <executions>

+          <execution>

+            <goals>

+              <goal>jdeprscan</goal>

+            </goals>

+          </execution>

+        </executions>

+        <configuration>

+          <release>9</release>

+        </configuration>

+      </plugin>

+    </plugins>

+  </build>

+</project>

diff --git a/src/it/projects/jdeprscan-release9/src/main/java/o/a/m/p/j/its/Deprecations.java b/src/it/projects/jdeprscan-release9/src/main/java/o/a/m/p/j/its/Deprecations.java
new file mode 100644
index 0000000..373dd32
--- /dev/null
+++ b/src/it/projects/jdeprscan-release9/src/main/java/o/a/m/p/j/its/Deprecations.java
@@ -0,0 +1,29 @@
+package o.a.m.p.j.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.

+ */

+ 

+import java.rmi.RMISecurityManager;

+

+public class Deprecations {

+  

+   SecurityManager sm = new RMISecurityManager();    // deprecated in 8

+    

+   Boolean b2 = new Boolean(true);          // deprecated in 9          

+}
\ No newline at end of file
diff --git a/src/it/projects/jdeprscan-release9/verify.groovy b/src/it/projects/jdeprscan-release9/verify.groovy
new file mode 100644
index 0000000..4478900
--- /dev/null
+++ b/src/it/projects/jdeprscan-release9/verify.groovy
@@ -0,0 +1,26 @@
+/*

+ * 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 buildLog.text.contains( "class o/a/m/p/j/its/Deprecations uses deprecated class java/rmi/RMISecurityManager" )

+assert buildLog.text.contains( "class o/a/m/p/j/its/Deprecations uses deprecated method java/lang/Boolean::<init>(Z)V" )

+ 

+

+

diff --git a/src/it/projects/list-default/invoker.properties b/src/it/projects/list-default/invoker.properties
new file mode 100644
index 0000000..27b10b0
--- /dev/null
+++ b/src/it/projects/list-default/invoker.properties
@@ -0,0 +1,17 @@
+# 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.goals = org.apache.maven.plugins:maven-jdeprscan-plugin:list
\ No newline at end of file
diff --git a/src/it/projects/list-forremoval/invoker.properties b/src/it/projects/list-forremoval/invoker.properties
new file mode 100644
index 0000000..27b10b0
--- /dev/null
+++ b/src/it/projects/list-forremoval/invoker.properties
@@ -0,0 +1,17 @@
+# 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.goals = org.apache.maven.plugins:maven-jdeprscan-plugin:list
\ No newline at end of file
diff --git a/src/it/projects/list-forremoval/test.properties b/src/it/projects/list-forremoval/test.properties
new file mode 100644
index 0000000..3bef1b6
--- /dev/null
+++ b/src/it/projects/list-forremoval/test.properties
@@ -0,0 +1,17 @@
+# 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.

+for-removal = true
\ No newline at end of file
diff --git a/src/it/projects/list-forremoval/verify.groovy b/src/it/projects/list-forremoval/verify.groovy
new file mode 100644
index 0000000..e9ca1dd
--- /dev/null
+++ b/src/it/projects/list-forremoval/verify.groovy
@@ -0,0 +1,26 @@
+/*

+ * 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' )

+

+def deprLines = buildLog.readLines().findAll { it =~ /^@Deprecated/ }

+assert !deprLines.isEmpty()

+ 

+def frLines = deprLines.findAll { it =~ /forRemoval=true/  }

+assert deprLines.size() == frLines.size()
\ No newline at end of file
diff --git a/src/it/settings.xml b/src/it/settings.xml
new file mode 100644
index 0000000..35dbcec
--- /dev/null
+++ b/src/it/settings.xml
@@ -0,0 +1,55 @@
+<?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.

+-->

+

+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

+  <profiles>

+    <profile>

+      <id>it-repo</id>

+      <repositories>

+        <repository>

+          <id>local.central</id>

+          <url>@localRepositoryUrl@</url>

+          <releases>

+            <enabled>true</enabled>

+          </releases>

+          <snapshots>

+            <enabled>true</enabled>

+          </snapshots>

+        </repository>

+      </repositories>

+      <pluginRepositories>

+        <pluginRepository>

+          <id>local.central</id>

+          <url>@localRepositoryUrl@</url>

+          <releases>

+            <enabled>true</enabled>

+          </releases>

+          <snapshots>

+            <enabled>true</enabled>

+          </snapshots>

+        </pluginRepository>

+      </pluginRepositories>

+    </profile>

+  </profiles>

+  <activeProfiles>

+    <activeProfile>it-repo</activeProfile>

+  </activeProfiles>

+</settings>

diff --git a/src/main/java/org/apache/maven/plugins/jdeprscan/AbstractJDeprScanMojo.java b/src/main/java/org/apache/maven/plugins/jdeprscan/AbstractJDeprScanMojo.java
new file mode 100644
index 0000000..d712345
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/jdeprscan/AbstractJDeprScanMojo.java
@@ -0,0 +1,286 @@
+package org.apache.maven.plugins.jdeprscan;

+

+/*

+ * 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.File;

+import java.io.IOException;

+import java.lang.reflect.Method;

+import java.util.Collections;

+import java.util.List;

+import java.util.Map;

+import java.util.Properties;

+import java.util.StringTokenizer;

+

+import org.apache.commons.lang3.SystemUtils;

+import org.apache.maven.execution.MavenSession;

+import org.apache.maven.plugin.AbstractMojo;

+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.Parameter;

+import org.apache.maven.plugins.jdeprscan.consumers.JDeprScanConsumer;

+import org.apache.maven.toolchain.Toolchain;

+import org.apache.maven.toolchain.ToolchainManager;

+import org.codehaus.plexus.util.StringUtils;

+import org.codehaus.plexus.util.cli.CommandLineException;

+import org.codehaus.plexus.util.cli.CommandLineUtils;

+import org.codehaus.plexus.util.cli.Commandline;

+

+/**

+ * Abstract class for all mojos

+ * 

+ * @author Robert Scholte

+ * @since 3.0.0

+ */

+public abstract class AbstractJDeprScanMojo

+    extends AbstractMojo

+{

+    @Parameter( defaultValue = "${session}", readonly = true, required = true )

+    private MavenSession session;

+    

+    

+    @Parameter()

+

+    @Component

+    private ToolchainManager toolchainManager;

+

+    @Override

+    public void execute()

+        throws MojoExecutionException, MojoFailureException

+    {

+        String jExecutable;

+        try

+        {

+            jExecutable = getJDeprScanExecutable();

+        }

+        catch ( IOException e )

+        {

+            throw new MojoFailureException( "Unable to find jdeprscan command: " + e.getMessage(), e );

+        }

+

+        // Synopsis

+        // jdeprscan [options] {dir|jar|class} ...

+        Commandline cmd = new Commandline();

+        cmd.setExecutable( jExecutable );

+

+        addJDeprScanOptions( cmd );

+

+        executeJDeprScanCommandLine( cmd, new JDeprScanConsumer() );

+    }

+    

+    protected abstract boolean isForRemoval();

+

+    protected void addJDeprScanOptions( Commandline cmd ) throws MojoFailureException

+    {

+        if ( isForRemoval() )

+        {

+            cmd.createArg().setValue( "--for-removal" );

+        }

+    }

+

+    private String getJDeprScanExecutable()

+        throws IOException

+    {

+        Toolchain tc = getToolchain();

+

+        String jdeprscanExecutable = null;

+        if ( tc != null )

+        {

+            jdeprscanExecutable = tc.findTool( "jdeprscan" );

+        }

+

+        String jdepsCommand = "jdeprscan" + ( SystemUtils.IS_OS_WINDOWS ? ".exe" : "" );

+

+        File jdeprscanExe;

+

+        if ( StringUtils.isNotEmpty( jdeprscanExecutable ) )

+        {

+            jdeprscanExe = new File( jdeprscanExecutable );

+

+            if ( jdeprscanExe.isDirectory() )

+            {

+                jdeprscanExe = new File( jdeprscanExe, jdepsCommand );

+            }

+

+            if ( SystemUtils.IS_OS_WINDOWS && jdeprscanExe.getName().indexOf( '.' ) < 0 )

+            {

+                jdeprscanExe = new File( jdeprscanExe.getPath() + ".exe" );

+            }

+

+            if ( !jdeprscanExe.isFile() )

+            {

+                throw new IOException( "The jdeprscan executable '" + jdeprscanExe

+                    + "' doesn't exist or is not a file." );

+            }

+            return jdeprscanExe.getAbsolutePath();

+        }

+

+        jdeprscanExe =

+            new File( SystemUtils.getJavaHome() + File.separator + ".." + File.separator + "sh", jdepsCommand );

+

+        // ----------------------------------------------------------------------

+        // Try to find jdepsExe from JAVA_HOME environment variable

+        // ----------------------------------------------------------------------

+        if ( !jdeprscanExe.exists() || !jdeprscanExe.isFile() )

+        {

+            Properties env = CommandLineUtils.getSystemEnvVars();

+            String javaHome = env.getProperty( "JAVA_HOME" );

+            if ( StringUtils.isEmpty( javaHome ) )

+            {

+                throw new IOException( "The environment variable JAVA_HOME is not correctly set." );

+            }

+            if ( ( !new File( javaHome ).getCanonicalFile().exists() )

+                || ( new File( javaHome ).getCanonicalFile().isFile() ) )

+            {

+                throw new IOException( "The environment variable JAVA_HOME=" + javaHome

+                    + " doesn't exist or is not a valid directory." );

+            }

+

+            jdeprscanExe = new File( javaHome + File.separator + "bin", jdepsCommand );

+        }

+

+        if ( !jdeprscanExe.getCanonicalFile().exists() || !jdeprscanExe.getCanonicalFile().isFile() )

+        {

+            throw new IOException( "The jdeps executable '" + jdeprscanExe

+                + "' doesn't exist or is not a file. Verify the JAVA_HOME environment variable." );

+        }

+

+        return jdeprscanExe.getAbsolutePath();

+    }

+

+    private void executeJDeprScanCommandLine( Commandline cmd,

+                                          CommandLineUtils.StringStreamConsumer consumer )

+        throws MojoExecutionException

+    {

+        if ( getLog().isDebugEnabled() )

+        {

+            // no quoted arguments

+            getLog().debug( "Executing: " + CommandLineUtils.toString( cmd.getCommandline() ).replaceAll( "'", "" ) );

+        }

+

+        CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();

+        CommandLineUtils.StringStreamConsumer out;

+        if ( consumer != null )

+        {

+            out = consumer;

+        }

+        else

+        {

+            out = new CommandLineUtils.StringStreamConsumer();

+        }

+

+        try

+        {

+            int exitCode = CommandLineUtils.executeCommandLine( cmd, out, err );

+

+            String output = ( StringUtils.isEmpty( out.getOutput() ) ? null : '\n' + out.getOutput().trim() );

+

+            if ( exitCode != 0 )

+            {

+                if ( StringUtils.isNotEmpty( output ) )

+                {

+                    getLog().info( output );

+                }

+

+                StringBuilder msg = new StringBuilder( "\nExit code: " );

+                msg.append( exitCode );

+                if ( StringUtils.isNotEmpty( err.getOutput() ) )

+                {

+                    msg.append( " - " ).append( err.getOutput() );

+                }

+                msg.append( '\n' );

+                msg.append( "Command line was: " ).append( cmd ).append( '\n' ).append( '\n' );

+

+                throw new MojoExecutionException( msg.toString() );

+            }

+

+            if ( StringUtils.isNotEmpty( output ) )

+            {

+                getLog().info( output );

+            }

+        }

+        catch ( CommandLineException e )

+        {

+            throw new MojoExecutionException( "Unable to execute jdeprscan command: " + e.getMessage(), e );

+        }

+

+        // ----------------------------------------------------------------------

+        // Handle JDeprScan warnings

+        // ----------------------------------------------------------------------

+

+        if ( StringUtils.isNotEmpty( err.getOutput() ) && getLog().isWarnEnabled() )

+        {

+            getLog().warn( "JDeprScan Warnings" );

+

+            StringTokenizer token = new StringTokenizer( err.getOutput(), "\n" );

+            while ( token.hasMoreTokens() )

+            {

+                String current = token.nextToken().trim();

+

+                getLog().warn( current );

+            }

+        }

+    }

+

+    private Toolchain getToolchain()

+    {

+        Toolchain tc = null;

+        if ( toolchainManager != null )

+        {

+            tc = toolchainManager.getToolchainFromBuildContext( "jdk", session );

+

+            if ( tc == null )

+            {

+                // Maven 3.2.6 has plugin execution scoped Toolchain Support

+                try

+                {

+                    Method getToolchainsMethod =

+                        toolchainManager.getClass().getMethod( "getToolchains", MavenSession.class, String.class,

+                                                               Map.class );

+

+                    @SuppressWarnings( "unchecked" )

+                    List<Toolchain> tcs =

+                        (List<Toolchain>) getToolchainsMethod.invoke( toolchainManager, session, "jdk",

+                                                                      Collections.singletonMap( "version", "[9,)" ) );

+

+                    if ( tcs != null && tcs.size() > 0 )

+                    {

+                        // pick up latest, jdeps of JDK9 has more options compared to JDK8

+                        tc = tcs.get( tcs.size() - 1 );

+                    }

+                }

+                catch ( ReflectiveOperationException e )

+                {

+                    // ignore

+                }

+                catch ( SecurityException e )

+                {

+                    // ignore

+                }

+                catch ( IllegalArgumentException e )

+                {

+                    // ignore

+                }

+            }

+        }

+

+        return tc;

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugins/jdeprscan/BaseJDeprScanMojo.java b/src/main/java/org/apache/maven/plugins/jdeprscan/BaseJDeprScanMojo.java
new file mode 100644
index 0000000..97cb8f8
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/jdeprscan/BaseJDeprScanMojo.java
@@ -0,0 +1,125 @@
+package org.apache.maven.plugins.jdeprscan;

+

+/*

+ * 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.File;

+import java.nio.file.Files;

+import java.nio.file.Path;

+import java.util.Collection;

+

+import org.apache.maven.artifact.DependencyResolutionRequiredException;

+import org.apache.maven.plugin.MojoExecutionException;

+import org.apache.maven.plugin.MojoFailureException;

+

+import org.apache.maven.plugins.annotations.Parameter;

+import org.apache.maven.project.MavenProject;

+import org.codehaus.plexus.util.StringUtils;

+import org.codehaus.plexus.util.cli.Commandline;

+

+/**

+ * Base class for all explicit jdeprscan mojos

+ * 

+ * @author Robert Scholte

+ * @since 3.0.0

+ */

+public abstract class BaseJDeprScanMojo extends AbstractJDeprScanMojo

+{

+    @Parameter( defaultValue = "${project}", readonly = true, required = true )

+    private MavenProject project;

+

+    /**

+     * Indicates whether the build will continue even if there are jdeprscan warnings.

+     */

+    @Parameter( defaultValue = "true" )

+    private boolean failOnWarning;

+    

+    /**

+     * Limits scanning or listing to APIs that are deprecated for removal. 

+     * Can’t be used with a release value of 6, 7, or 8.

+     */

+    @Parameter( property = "maven.jdeprscan.forremoval" )

+    private boolean forRemoval;

+

+    /**

+     * Specifies the Java SE release that provides the set of deprecated APIs for scanning.

+     */

+    @Parameter

+    private String release;

+    

+    @Override

+    public void execute()

+        throws MojoExecutionException, MojoFailureException

+    {

+        if ( !Files.exists( getClassesDirectory() ) )

+        {

+            getLog().debug( "No classes to analyze" );

+            return;

+        }

+        super.execute();

+    }

+

+    protected MavenProject getProject()

+    {

+        return project;

+    }

+    

+    @Override

+    protected boolean isForRemoval()

+    {

+        return forRemoval;

+    }

+    

+    @Override

+    protected final void addJDeprScanOptions( Commandline cmd ) throws MojoFailureException

+    {

+        super.addJDeprScanOptions( cmd );

+

+        if ( release != null )

+        {

+            cmd.createArg().setValue( "--release" );

+

+            cmd.createArg().setValue( release );

+        }

+

+        try

+        {

+            Collection<Path> cp = getClassPath();

+            

+            if ( !cp.isEmpty() )

+            {

+                cmd.createArg().setValue( "--class-path" );

+

+                cmd.createArg().setValue( StringUtils.join( cp.iterator(), File.pathSeparator ) );

+            }

+            

+        }

+        catch ( DependencyResolutionRequiredException e )

+        {

+            throw new MojoFailureException( e.getMessage(), e );

+        }

+        

+        cmd.createArg().setFile( getClassesDirectory().toFile() );

+    }

+    

+

+    protected abstract Path getClassesDirectory();

+    

+    protected abstract Collection<Path> getClassPath() throws DependencyResolutionRequiredException;

+}

diff --git a/src/main/java/org/apache/maven/plugins/jdeprscan/JDeprScanMojo.java b/src/main/java/org/apache/maven/plugins/jdeprscan/JDeprScanMojo.java
new file mode 100644
index 0000000..7da7982
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/jdeprscan/JDeprScanMojo.java
@@ -0,0 +1,64 @@
+package org.apache.maven.plugins.jdeprscan;

+

+/*

+ * 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.nio.file.Path;

+import java.nio.file.Paths;

+import java.util.Collection;

+import java.util.LinkedHashSet;

+import java.util.Set;

+

+import org.apache.maven.artifact.DependencyResolutionRequiredException;

+import org.apache.maven.plugins.annotations.LifecyclePhase;

+import org.apache.maven.plugins.annotations.Mojo;

+import org.apache.maven.plugins.annotations.ResolutionScope;

+

+/**

+ * Scans main classes with jdeprscan tool

+ * 

+ * @author Robert Scholte

+ * @since 3.0.0

+ */

+@Mojo( name = "jdeprscan", 

+       requiresDependencyResolution = ResolutionScope.COMPILE,

+       defaultPhase = LifecyclePhase.PROCESS_CLASSES, 

+       threadSafe = true )

+public class JDeprScanMojo extends BaseJDeprScanMojo

+{

+    @Override

+    protected Path getClassesDirectory()

+    {

+        return Paths.get( getProject().getBuild().getOutputDirectory() );

+    }

+    

+    @Override

+    protected Collection<Path> getClassPath()

+        throws DependencyResolutionRequiredException

+    {

+        Set<Path> classPath = new LinkedHashSet<>( getProject().getCompileClasspathElements().size() );

+

+        for ( String elm : getProject().getCompileClasspathElements() )

+        {

+            classPath.add( Paths.get( elm ) );

+        }

+

+        return classPath;

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugins/jdeprscan/ListMojo.java b/src/main/java/org/apache/maven/plugins/jdeprscan/ListMojo.java
new file mode 100644
index 0000000..d4a19d0
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/jdeprscan/ListMojo.java
@@ -0,0 +1,58 @@
+package org.apache.maven.plugins.jdeprscan;

+

+/*

+ * 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.apache.maven.plugin.MojoFailureException;

+import org.apache.maven.plugins.annotations.Mojo;

+import org.apache.maven.plugins.annotations.Parameter;

+import org.codehaus.plexus.util.cli.Commandline;

+

+/**

+ * Prints the set of deprecated APIs. No scanning is done.

+ * 

+ * @author Robert Scholte

+ * @since 3.0.0

+ */

+@Mojo( name = "list", requiresProject = false, requiresDirectInvocation = true )

+public class ListMojo

+    extends AbstractJDeprScanMojo

+{

+    /**

+     * Limits scanning or listing to APIs that are deprecated for removal. Can’t be used with a release value of 6, 7,

+     * or 8.

+     */

+    @Parameter( property = "for-removal" )

+    private boolean forRemoval;

+

+    @Override

+    protected boolean isForRemoval()

+    {

+        return forRemoval;

+    }

+

+    @Override

+    protected void addJDeprScanOptions( Commandline cmd )

+        throws MojoFailureException

+    {

+        super.addJDeprScanOptions( cmd );

+

+        cmd.createArg().setValue( "--list" );

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugins/jdeprscan/TestJDeprScanMojo.java b/src/main/java/org/apache/maven/plugins/jdeprscan/TestJDeprScanMojo.java
new file mode 100644
index 0000000..88cee58
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/jdeprscan/TestJDeprScanMojo.java
@@ -0,0 +1,64 @@
+package org.apache.maven.plugins.jdeprscan;

+

+/*

+ * 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.nio.file.Path;

+import java.nio.file.Paths;

+import java.util.Collection;

+import java.util.LinkedHashSet;

+import java.util.Set;

+

+import org.apache.maven.artifact.DependencyResolutionRequiredException;

+import org.apache.maven.plugins.annotations.LifecyclePhase;

+import org.apache.maven.plugins.annotations.Mojo;

+import org.apache.maven.plugins.annotations.ResolutionScope;

+

+/**

+ * Scans test classes with jdeprscan

+ * 

+ * @author Robert Scholte

+ * @since 3.0.0

+ */

+@Mojo( name = "test-jdeprscan", 

+       requiresDependencyResolution = ResolutionScope.TEST, 

+       defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES, 

+       threadSafe = true )

+public class TestJDeprScanMojo extends BaseJDeprScanMojo

+{

+    @Override

+    protected Path getClassesDirectory()

+    {

+        return Paths.get( getProject().getBuild().getTestOutputDirectory() );

+    }

+    

+    @Override

+    protected Collection<Path> getClassPath()

+        throws DependencyResolutionRequiredException

+    {

+        Set<Path> classPath = new LinkedHashSet<>( getProject().getTestClasspathElements().size() );

+

+        for ( String elm : getProject().getTestClasspathElements() )

+        {

+            classPath.add( Paths.get( elm ) );

+        }

+

+        return classPath;

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugins/jdeprscan/consumers/JDeprScanConsumer.java b/src/main/java/org/apache/maven/plugins/jdeprscan/consumers/JDeprScanConsumer.java
new file mode 100644
index 0000000..3983efd
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/jdeprscan/consumers/JDeprScanConsumer.java
@@ -0,0 +1,36 @@
+package org.apache.maven.plugins.jdeprscan.consumers;

+

+/*

+ * 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.codehaus.plexus.util.cli.CommandLineUtils;

+import org.codehaus.plexus.util.cli.StreamConsumer;

+

+/**

+ * Consumes output of jdeprscan tool

+ * 

+ * @author Robert Scholte

+ * @since 3.0.0

+ */

+public class JDeprScanConsumer

+    extends CommandLineUtils.StringStreamConsumer

+    implements StreamConsumer

+{

+

+}