Browse Source

Prepare main artifacts to be deployed via Maven, step 1

This change affects the following modules:
  - aspectjmatcher
  - aspectjrt
  - aspectjtools
  - aspectjweaver
  - installer

They have in common that they all use Maven Assembly Plugin in order to
create some kind of uber JARs with constituent modules and/or libraries.
Except for the installer, they are all available on Maven Central today,
but I think it would not hurt to deploy the installer to there, too.

Changes made:
  - Use Flatten Maven Plugin in order to create simple POMs with only
    basic information and - most importantly - without dependencies.
  - The new dependency-reduced POM (DRP) or "flattened POM" gets
    attached to the build, i.e. it will be installed and deployed as a
    replacement of the original POM.
  - Attaching the DRP only works for 'jar' type modules, which is why I
    changed the packaging type for each module from 'pom' to 'jar'.
  - Deactivate generation of the default JAR for each module. This is
    necessary now, since we have the 'jar' packaging type.
  - Make sure that assembly descriptors using 'dependencySet' entries
    have set option 'useProjectArtifact=false' in order to avoid
    warnings about the non-existing main artifact.

TODO:
  - Explore option to migrate from Maven Assembly to Maven Shade,
    because it does not need descriptor files, can also generate source
    JARs and can automatically create and attach a DRP which is less
    fragmentary than the one created by Flatten Maven, basically the
    original JAR minus the dependencies.
  - If in the future we want to make sure to only deploy the modules
    listed above, e.g. to Maven Central, if simply calling 'mvn deploy'
    for the whole project, we could use 'maven.deploy.skip=true' in the
    parent POM and override it by 'maven.deploy.skip=false' just in the
    few modules which need to be deployed. See also:
    https://stackoverflow.com/a/29574812/1082681
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
tags/V1_9_7_M2
Alexander Kriegisch 3 years ago
parent
commit
18f3385e23

+ 30
- 2
aspectjmatcher/pom.xml View File

@@ -11,17 +11,20 @@
</parent>

<artifactId>aspectjmatcher</artifactId>
<packaging>pom</packaging>
<name>AspectJ Matcher</name>

<build>
<plugins>

<!-- skip creation of test-jar in here -->
<!-- Skip creation of main + test JARs -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
<execution>
<id>test-jar</id>
<phase>none</phase>
@@ -116,6 +119,31 @@
</executions>
</plugin>

<!-- Caveat: Attaching the flattened POM needs packaging=jar, so do not use packaging=pom for this module -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<executions>
<!-- Remove dependencies declared in this POM (if any) from uber JAR and strip down POM -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
<configuration>
<flattenMode>oss</flattenMode>
<pomElements>
<dependencies>remove</dependencies>
<repositories>remove</repositories>
</pomElements>
<outputDirectory>${project.build.directory}</outputDirectory>
<flattenedPomFilename>flattened-pom.xml</flattenedPomFilename>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>

+ 30
- 2
aspectjrt/pom.xml View File

@@ -11,7 +11,6 @@
</parent>

<artifactId>aspectjrt</artifactId>
<packaging>pom</packaging>
<name>AspectJ Runtime</name>

<dependencies>
@@ -25,11 +24,15 @@
<build>
<plugins>

<!-- skip creation of test-jar in here -->
<!-- Skip creation of main + test JARs -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
<execution>
<id>test-jar</id>
<phase>none</phase>
@@ -118,6 +121,31 @@
</executions>
</plugin>

<!-- Caveat: Attaching the flattened POM needs packaging=jar, so do not use packaging=pom for this module -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<executions>
<!-- Remove dependencies declared in this POM (if any) from uber JAR and strip down POM -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
<configuration>
<flattenMode>oss</flattenMode>
<pomElements>
<dependencies>remove</dependencies>
<repositories>remove</repositories>
</pomElements>
<outputDirectory>${project.build.directory}</outputDirectory>
<flattenedPomFilename>flattened-pom.xml</flattenedPomFilename>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>

+ 2
- 0
aspectjtools/aspectjtools-assembly.xml View File

@@ -13,6 +13,8 @@
<dependencySets>
<dependencySet>
<unpack>true</unpack>
<!-- Avoid warning when trying to add non-existing main artifact JAR -->
<useProjectArtifact>false</useProjectArtifact>
<includes>
<include>org.aspectj:org.eclipse.jdt.core</include>
<include>org.aspectj:asm-renamed</include>

+ 30
- 2
aspectjtools/pom.xml View File

@@ -11,17 +11,20 @@
</parent>

<artifactId>aspectjtools</artifactId>
<packaging>pom</packaging>
<name>AspectJ Compiler</name>

<build>
<plugins>

<!-- skip creation of test-jar in here -->
<!-- Skip creation of main + test JARs -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
<execution>
<id>test-jar</id>
<phase>none</phase>
@@ -132,6 +135,31 @@
</executions>
</plugin>

<!-- Caveat: Attaching the flattened POM needs packaging=jar, so do not use packaging=pom for this module -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<executions>
<!-- Remove dependencies declared in this POM (if any) from uber JAR and strip down POM -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
<configuration>
<flattenMode>oss</flattenMode>
<pomElements>
<dependencies>remove</dependencies>
<repositories>remove</repositories>
</pomElements>
<outputDirectory>${project.build.directory}</outputDirectory>
<flattenedPomFilename>flattened-pom.xml</flattenedPomFilename>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>


+ 2
- 0
aspectjweaver/aspectjweaver-assembly.xml View File

@@ -13,6 +13,8 @@
<dependencySets>
<dependencySet>
<unpack>true</unpack>
<!-- Avoid warning when trying to add non-existing main artifact JAR -->
<useProjectArtifact>false</useProjectArtifact>
<includes>
<include>org.aspectj:asm-renamed</include>
</includes>

+ 30
- 2
aspectjweaver/pom.xml View File

@@ -11,17 +11,20 @@
</parent>

<artifactId>aspectjweaver</artifactId>
<packaging>pom</packaging>
<name>AspectJ Weaver</name>

<build>
<plugins>

<!-- skip creation of test-jar in here -->
<!-- Skip creation of main + test JARs -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
<execution>
<id>test-jar</id>
<phase>none</phase>
@@ -135,6 +138,31 @@
</executions>
</plugin>

<!-- Caveat: Attaching the flattened POM needs packaging=jar, so do not use packaging=pom for this module -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<executions>
<!-- Remove dependencies declared in this POM (if any) from uber JAR and strip down POM -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
<configuration>
<flattenMode>oss</flattenMode>
<pomElements>
<dependencies>remove</dependencies>
<repositories>remove</repositories>
</pomElements>
<outputDirectory>${project.build.directory}</outputDirectory>
<flattenedPomFilename>flattened-pom.xml</flattenedPomFilename>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>


+ 32
- 2
installer/pom.xml View File

@@ -11,7 +11,6 @@
</parent>

<artifactId>installer</artifactId>
<packaging>pom</packaging>
<name>AspectJ Installer</name>

<dependencies>
@@ -24,11 +23,16 @@

<build>
<plugins>
<!-- skip creation of test-jar in here -->

<!-- Skip creation of main + test JARs -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
<execution>
<id>test-jar</id>
<phase>none</phase>
@@ -61,6 +65,32 @@
</execution>
</executions>
</plugin>

<!-- Caveat: Attaching the flattened POM needs packaging=jar, so do not use packaging=pom for this module -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<executions>
<!-- Remove dependencies declared in this POM (if any) from uber JAR and strip down POM -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
<configuration>
<flattenMode>oss</flattenMode>
<pomElements>
<dependencies>remove</dependencies>
<repositories>remove</repositories>
</pomElements>
<outputDirectory>${project.build.directory}</outputDirectory>
<flattenedPomFilename>flattened-pom.xml</flattenedPomFilename>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>

+ 5
- 0
pom.xml View File

@@ -216,6 +216,11 @@
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.2.2</version>
</plugin>
</plugins>
</pluginManagement>


Loading…
Cancel
Save