]> source.dussan.org Git - aspectj.git/commitdiff
Module 'asm-renamed' now deploys to GitHub Packages
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Fri, 9 Apr 2021 07:00:57 +0000 (14:00 +0700)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Fri, 9 Apr 2021 07:00:57 +0000 (14:00 +0700)
This means that instead of a system-scoped dependency we now have a
regular one.

The 'libx' module also downloads binary and source JARs redundantly into
the libraries directory in order to be found there by other scripts and
tests.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
ajdoc/pom.xml
asm-renamed/pom.xml [new file with mode: 0644]
libx/pom.xml
pom.xml
tests/pom.xml
weaver/pom.xml

index 3b1b64f5d815d078b9c316f73cb92827e956f923..f7ae7ab00b312b87b144cc2c5fc4eba56bc05f89 100644 (file)
       <artifactId>maven-jdk-tools-wrapper</artifactId>
       <version>0.1</version>
     </dependency>
-    <dependency>
-      <groupId>asm</groupId>
-      <artifactId>asm</artifactId>
-      <version>1.0</version>
-      <scope>system</scope>
-      <systemPath>${project.basedir}/../lib/asm/asm-9.1.renamed.jar</systemPath>
-    </dependency>
 
     <!-- Dependencies needed for running tests in this module independently of complete reactor build -->
     <dependency>
diff --git a/asm-renamed/pom.xml b/asm-renamed/pom.xml
new file mode 100644 (file)
index 0000000..bb29f78
--- /dev/null
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+
+  <!-- The AspectJ root POM is the parent, but this module is not a submodule -->
+  <parent>
+    <groupId>org.aspectj</groupId>
+    <artifactId>aspectj-parent</artifactId>
+    <version>1.9.7.BUILD-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>asm-renamed</artifactId>
+  <version>${asm.version}</version>
+
+  <name>ASM for AspectJ</name>
+  <description>
+    This module relocates the original ASM artifact from package name 'org.objectweb.asm' to 'aj.org.objectweb.asm',
+    using Maven Shade Plugin.
+
+    In order to avoid committing the binary to the AspectJ SCM repository and using it as a system-scoped dependency, we
+    deploy it to GitHub Packages.
+
+    Whenever it is necessary to upgrade to a new ASM version in order to make AspectJ compatible with a new Java
+    version, please build and deploy this module after upgrading property 'asm.version'. Make sure you have a GitHub
+    token with the necessary access rights and section like this in your settings.xml:
+
+    <![CDATA[
+    <server>
+      <id>github</id>
+      <username>MY_GITHUB_USER</username>
+      <password>MY_GITHUB_TOKEN</password>
+    </server>
+    ]]>
+
+    Then you should be able to run 'mvn clean deploy' for this module and be fine.
+
+    Caveat for IntelliJ IDEA: The project cannot be built in IDEA (Ctrl-F9) if this module is visible in the Maven view.
+    If so, right-click it and select "Unlink Maven Projects". Unfortunately, "Ignore Projects" is not enough. If Maven
+    knows of this Maven module, it cannot compile other modules depending on shaded class names, because it cannot find
+    the binaries. IDEA will just stop looking at the local Maven repository in this case.
+  </description>
+
+  <distributionManagement>
+    <repository>
+      <id>github</id>
+      <name>GitHub Packages Release</name>
+      <url>https://maven.pkg.github.com/kriegaex/aspectj-packages</url>
+      <uniqueVersion>false</uniqueVersion>
+    </repository>
+    <snapshotRepository>
+      <id>github</id>
+      <name>GitHub Packages Snapshot</name>
+      <url>https://maven.pkg.github.com/kriegaex/aspectj-packages</url>
+      <uniqueVersion>true</uniqueVersion>
+    </snapshotRepository>
+  </distributionManagement>
+
+  <build>
+    <plugins>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <executions>
+          <!-- Nothing to compile in this module -->
+          <execution>
+            <id>default-compile</id>
+            <phase>none</phase>
+          </execution>
+          <execution>
+            <id>default-testCompile</id>
+            <phase>none</phase>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+        <configuration>
+          <!-- Re-create original source JAR in order to avoid re-shading already shaded JAR in non-clean builds -->
+          <forceCreation>true</forceCreation>
+          <!--
+            Avoid attaching the source JAR here, because Maven Shade will add the source uber JAR later. Because both
+            JARs have the same final name, Maven Install/Deploy would see two artifacts attached to the build, which
+            would lead to double deployment and hence to an error "Transfer failed for ...-sources.jar 409 Conflict".
+            See also https://issues.apache.org/jira/browse/MDEPLOY-254 and comments by Alexander Kriegisch.
+          -->
+          <attach>false</attach>
+          <archive>
+            <addMavenDescriptor>false</addMavenDescriptor>
+          </archive>
+        </configuration>
+        <executions>
+          <execution>
+            <id>attach-sources</id>
+            <phase>package</phase>
+            <goals>
+              <goal>jar-no-fork</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <addMavenDescriptor>false</addMavenDescriptor>
+          </archive>
+          <!-- Re-create original JAR in order to avoid re-shading already shaded JAR in non-clean builds -->
+          <forceCreation>true</forceCreation>
+        </configuration>
+        <executions>
+          <execution>
+            <!-- Avoid creating test JAR -->
+            <id>test-jar</id>
+            <phase>none</phase>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <configuration>
+          <createSourcesJar>true</createSourcesJar>
+          <createDependencyReducedPom>false</createDependencyReducedPom>
+          <shadedArtifactAttached>false</shadedArtifactAttached>
+        </configuration>
+        <executions>
+          <execution>
+            <id>asm-relocate</id>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <minimizeJar>false</minimizeJar>
+              <shadeSourcesContent>true</shadeSourcesContent>
+              <artifactSet>
+                <excludes>
+                  <exclude>${project.groupId}</exclude>
+                </excludes>
+              </artifactSet>
+              <filters>
+                <filter>
+                  <artifact>*</artifact>
+                  <excludes>
+                    <exclude>META-INF/*</exclude>
+                  </excludes>
+                </filter>
+              </filters>
+              <relocations>
+                <relocation>
+                  <pattern>org.objectweb.asm</pattern>
+                  <shadedPattern>aj.org.objectweb.asm</shadedPattern>
+                </relocation>
+              </relocations>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>flatten-maven-plugin</artifactId>
+        <version>1.2.2</version>
+        <executions>
+          <!-- Remove shaded dependencies from uber JAR -->
+          <execution>
+            <id>flatten</id>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>flatten</goal>
+            </goals>
+            <configuration>
+              <flattenMode>oss</flattenMode>
+              <pomElements>
+                <dependencies>remove</dependencies>
+              </pomElements>
+              <outputDirectory>${project.build.directory}</outputDirectory>
+              <flattenedPomFilename>flattened-pom.xml</flattenedPomFilename>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.ow2.asm</groupId>
+      <artifactId>asm</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>
index c30de98e08d6504155bfad5216acca460b090000..4c4817e79d5f0908537f911126d7f46b5f9239a3 100644 (file)
                   <destFileName>jdtcore-for-aspectj-src.zip</destFileName>
                 </artifactItem>
 
+                <artifactItem>
+                  <!-- Available from GitHub Packages (needs special repository declaration) -->
+                  <groupId>org.aspectj</groupId>
+                  <artifactId>asm-renamed</artifactId>
+                  <version>${asm.version}</version>
+                  <type>jar</type>
+                  <overWrite>false</overWrite>
+                  <outputDirectory>asm</outputDirectory>
+                  <destFileName>asm-${asm.version}.renamed.jar</destFileName>
+                </artifactItem>
+                <artifactItem>
+                  <!-- Available from GitHub Packages (needs special repository declaration) -->
+                  <groupId>org.aspectj</groupId>
+                  <artifactId>asm-renamed</artifactId>
+                  <version>${asm.version}</version>
+                  <type>java-source</type>
+                  <classifier>sources</classifier>
+                  <overWrite>false</overWrite>
+                  <outputDirectory>asm</outputDirectory>
+                  <destFileName>asm-${asm.version}.renamed-src.zip</destFileName>
+                </artifactItem>
+
                 <!--
                   How relevant is JRockit in 2021?
                   https://en.wikipedia.org/wiki/JRockit
               <directory>.</directory>
               <includes>
                 <include>ant/**</include>
+                <include>asm/**</include>
                 <include>commons/**</include>
                 <include>jarjar/**</include>
                 <include>jdiff/**</include>
   </build>
 
   <dependencies>
+    <dependency>
+      <groupId>org.aspectj</groupId>
+      <artifactId>asm-renamed</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.aspectj</groupId>
       <artifactId>org.eclipse.jdt.core</artifactId>
diff --git a/pom.xml b/pom.xml
index 09acc2be6a6a94a0e6e2cc06508ebde4792eba50..ade7b903d11c9924f439c771d1b8f4d9a5bdd56c 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -72,6 +72,7 @@
 
                <!-- FYI: These are NOT meant to be sub-modules but a stand-alone projects built and deployed independently. -->
                <!--
+               <module>asm-renamed</module>
                <module>libx</module>
                -->
 
                                                                        <files>
                                                                                <file>${lib.directory}/ant/bin/ant</file>
                                                                                <file>${lib.directory}/ant/lib/junit.jar</file>
+                                                                               <file>${lib.directory}/asm/asm-${asm.version}.renamed.jar</file>
                                                                                <file>${lib.directory}/commons/commons.jar</file>
                                                                                <file>${lib.directory}/jarjar/jarjar-1.3.jar</file>
                                                                                <file>${lib.directory}/jdtcore-aj/jdtcore-for-aspectj.jar</file>
                                <artifactId>commons-beanutils</artifactId>
                                <version>${lib.commons.beanutils.version}</version>
                        </dependency>
+                       <dependency>
+                               <groupId>org.aspectj</groupId>
+                               <artifactId>asm-renamed</artifactId>
+                               <version>${asm.version}</version>
+                       </dependency>
                </dependencies>
        </dependencyManagement>
 
index 11f91a216a9308eebfa8255cc5b5e752a8fb80d4..0f766d006f09db95753021271173dadfe544b81f 100644 (file)
                        <version>${project.version}</version>
                </dependency>
                <dependency>
-                       <groupId>asm</groupId>
-                       <artifactId>asm</artifactId>
-                       <version>1.0</version>
-                       <scope>system</scope>
-                       <systemPath>${project.basedir}/../lib/asm/asm-9.1.renamed.jar</systemPath>
+                       <groupId>org.aspectj</groupId>
+                       <artifactId>asm-renamed</artifactId>
                </dependency>
                <dependency>
                        <groupId>org.aspectj</groupId>
index 2973f75041899d96b9f9775998c3a4eb66d9be02..6bf419ab8fb55a049b93f78ce498c819520f2a80 100644 (file)
     </dependency>
 -->
     <dependency>
-      <groupId>asm</groupId>
-      <artifactId>asm</artifactId>
-      <version>1.0</version>
-      <scope>system</scope>
-      <systemPath>${project.basedir}/../lib/asm/asm-9.1.renamed.jar</systemPath>
+      <groupId>org.aspectj</groupId>
+      <artifactId>asm-renamed</artifactId>
     </dependency>
   </dependencies>
 </project>