]> source.dussan.org Git - aspectj.git/commitdiff
Fix undetected runtime dependency usage problem from previous commit
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Mon, 12 Apr 2021 06:39:56 +0000 (13:39 +0700)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Mon, 12 Apr 2021 06:51:23 +0000 (13:51 +0700)
In module 'ajdoc', our tests need tools.jar when running on JDK 8 in
order to dynamically compile during runtime. Hence, dependency
com.github.olivergondza:maven-jdk-tools-wrapper was re-added to the POM
(with test scope this time) and Maven Dependency plugin configured to
regard it as a used dependency and not falsely report it as unused.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
ajdoc/pom.xml
pom.xml

index dee6a59ca5800caf98ae7855c8443d370c8b62e7..28076699dccba1a3fdfe3c464d57227d819f7e41 100644 (file)
   <packaging>jar</packaging>
   <name>ajdoc</name>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <configuration>
+          <usedDependencies>
+            <!-- The tests need this during runtime, even though no direct usage is in our classes -->
+            <usedDependency>com.github.olivergondza:maven-jdk-tools-wrapper</usedDependency>
+          </usedDependencies>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
   <dependencies>
     <dependency>
       <groupId>org.aspectj</groupId>
       <artifactId>org.aspectj.ajdt.core</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <!-- enables easy dependency on tools.jar -->
+      <groupId>com.github.olivergondza</groupId>
+      <artifactId>maven-jdk-tools-wrapper</artifactId>
+      <version>0.1</version>
+    </dependency>
     <dependency>
       <groupId>org.aspectj</groupId>
       <artifactId>asm-renamed</artifactId>
diff --git a/pom.xml b/pom.xml
index 81b26d74450af53652564d1116f53cfee6df39b2..8ba2e0299b8577ca3f12d171008ea3dbb136facf 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                        <!--
                                This plugin is nice to have in the POM, because then it is easy to double-click a goal such as 'analyze' or
                                'tree' from a modern IDE in order to inspect dependency management in the project.
+
+                               Tip: If you want a quick overview, run this from the project from the project root directory:
+                               mvn -P \!create-docs dependency:analyze | grep -E '\[(WARNING|INFO\] -+< .+:.+ >-+)' > dependency-analyze.txt
+                               But be careful that all modules are actually listed - usually 'org.aspectj:installer' is the last one in the
+                               list. You can make sure by running the command without 'grep' first, then you see if there are any compile
+                               problems which 'grep' would filter out.
                        -->
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-dependency-plugin</artifactId>
-                               <version>3.1.2</version>
                                <configuration>
                                        <ignoredUnusedDeclaredDependencies>
                                                <!-- Declared in parent POM for convenience, but not used in every module -->