Packaging: mvn install renames artifacts when copying

This PR:

* renames all distribution artifacts to `elasticsearch` so maven plugins will pick up the correct finalName without needing any hack.
* changes the groupId for every single distribution module as we can't have more than one module using the same groupId:artifactId
* does not attach anymore empty jar files for tar/zip/... modules as they don't contain any `src/main/java` stuff.

When you build it, you end up with:

```
$ tree ~/.m2/repository/org/elasticsearch/distribution
distribution
├── deb
│   └── elasticsearch
│       ├── 2.0.0-beta1-SNAPSHOT
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.deb
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.deb.md5
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.deb.sha1
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.md5
│       │   └── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.sha1
├── elasticsearch-distribution
│   ├── 2.0.0-beta1-SNAPSHOT
│   │   ├── elasticsearch-distribution-2.0.0-beta1-SNAPSHOT.pom
│   │   ├── elasticsearch-distribution-2.0.0-beta1-SNAPSHOT.pom.md5
│   │   └── elasticsearch-distribution-2.0.0-beta1-SNAPSHOT.pom.sha1
├── fully-loaded
│   └── elasticsearch
│       ├── 2.0.0-beta1-SNAPSHOT
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.md5
│       │   └── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.sha1
├── rpm
│   └── elasticsearch
│       ├── 2.0.0-beta1-SNAPSHOT
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.md5
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.sha1
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.rpm
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.rpm.md5
│       │   └── elasticsearch-2.0.0-beta1-SNAPSHOT.rpm.sha1
├── shaded
│   └── elasticsearch
│       ├── 2.0.0-beta1-SNAPSHOT
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.jar
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.jar.md5
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.jar.sha1
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.md5
│       │   └── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.sha1
├── tar
│   └── elasticsearch
│       ├── 2.0.0-beta1-SNAPSHOT
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.md5
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.sha1
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.tar.gz
│       │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.tar.gz.md5
│       │   └── elasticsearch-2.0.0-beta1-SNAPSHOT.tar.gz.sha1
└── zip
    └── elasticsearch
        └── 2.0.0-beta1-SNAPSHOT
            ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom
            ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.md5
            ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.sha1
            ├── elasticsearch-2.0.0-beta1-SNAPSHOT.zip
            ├── elasticsearch-2.0.0-beta1-SNAPSHOT.zip.md5
            ├── elasticsearch-2.0.0-beta1-SNAPSHOT.zip.sha1
            └──
```

Closes #12536
This commit is contained in:
David Pilato 2015-08-04 12:30:39 +02:00
parent e8ccdf91fc
commit c61dccd189
9 changed files with 48 additions and 20 deletions

View File

@ -9,8 +9,14 @@
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>elasticsearch-deb</artifactId> <groupId>org.elasticsearch.distribution.deb</groupId>
<artifactId>elasticsearch</artifactId>
<name>Elasticsearch DEB Distribution</name> <name>Elasticsearch DEB Distribution</name>
<!--
We should use deb packaging here because we don't want to publish any jar.
But if you do this, then maven lifecycle does not execute any test (nor compile any test)
-->
<!--packaging>deb</packaging-->
<properties> <properties>
<deb.sign>false</deb.sign> <deb.sign>false</deb.sign>
@ -19,8 +25,8 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.elasticsearch.distribution</groupId> <groupId>org.elasticsearch.distribution.fully-loaded</groupId>
<artifactId>elasticsearch-fully-loaded</artifactId> <artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version> <version>${elasticsearch.version}</version>
<type>pom</type> <type>pom</type>
</dependency> </dependency>
@ -90,7 +96,6 @@
<!-- some infos https://github.com/tcurdt/jdeb/blob/master/docs/maven.md --> <!-- some infos https://github.com/tcurdt/jdeb/blob/master/docs/maven.md -->
<artifactId>jdeb</artifactId> <artifactId>jdeb</artifactId>
<groupId>org.vafer</groupId> <groupId>org.vafer</groupId>
<version>1.4</version>
<configuration> <configuration>
<!-- By default it should generates target/${artifactId}_${version}.deb but we get elasticsearch_2.0.0~SNAPSHOT_all.deb --> <!-- By default it should generates target/${artifactId}_${version}.deb but we get elasticsearch_2.0.0~SNAPSHOT_all.deb -->
<deb>${project.build.directory}/releases/elasticsearch-${project.version}.deb</deb> <deb>${project.build.directory}/releases/elasticsearch-${project.version}.deb</deb>
@ -253,6 +258,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>

View File

@ -9,7 +9,8 @@
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>elasticsearch-fully-loaded</artifactId> <groupId>org.elasticsearch.distribution.fully-loaded</groupId>
<artifactId>elasticsearch</artifactId>
<name>Elasticsearch with all optional dependencies</name> <name>Elasticsearch with all optional dependencies</name>
<packaging>pom</packaging> <packaging>pom</packaging>

View File

@ -71,7 +71,6 @@
</dependencies> </dependencies>
<build> <build>
<finalName>elasticsearch-${project.version}</finalName>
<plugins> <plugins>
<!-- We copy libs for deb and rpm --> <!-- We copy libs for deb and rpm -->
<plugin> <plugin>
@ -156,6 +155,14 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<!-- distribution modules don't provide any jar. No need to upload empty jars to maven central -->
<skipIfEmpty>true</skipIfEmpty>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>com.carrotsearch.randomizedtesting</groupId> <groupId>com.carrotsearch.randomizedtesting</groupId>
<artifactId>junit4-maven-plugin</artifactId> <artifactId>junit4-maven-plugin</artifactId>

View File

@ -9,14 +9,15 @@
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>elasticsearch-rpm</artifactId> <groupId>org.elasticsearch.distribution.rpm</groupId>
<artifactId>elasticsearch</artifactId>
<name>Elasticsearch RPM Distribution</name> <name>Elasticsearch RPM Distribution</name>
<packaging>rpm</packaging> <packaging>rpm</packaging>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.elasticsearch.distribution</groupId> <groupId>org.elasticsearch.distribution.fully-loaded</groupId>
<artifactId>elasticsearch-fully-loaded</artifactId> <artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version> <version>${elasticsearch.version}</version>
<type>pom</type> <type>pom</type>
</dependency> </dependency>
@ -301,7 +302,6 @@
<type>${project.packaging}</type> <type>${project.packaging}</type>
<overWrite>true</overWrite> <overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/releases/</outputDirectory> <outputDirectory>${project.build.directory}/releases/</outputDirectory>
<destFileName>elasticsearch-${project.version}.rpm</destFileName>
</artifactItem> </artifactItem>
</artifactItems> </artifactItems>
</configuration> </configuration>

View File

@ -9,7 +9,8 @@
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>elasticsearch-shaded</artifactId> <groupId>org.elasticsearch.distribution.shaded</groupId>
<artifactId>elasticsearch</artifactId>
<name>Elasticsearch Shaded Distribution</name> <name>Elasticsearch Shaded Distribution</name>
<dependencies> <dependencies>
@ -21,13 +22,13 @@
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<!-- see docs, incremental builds dont play well with shading otherwise --> <!-- see docs, incremental builds dont play well with shading otherwise -->
<configuration> <configuration>
<skipIfEmpty>false</skipIfEmpty>
<forceCreation>true</forceCreation> <forceCreation>true</forceCreation>
</configuration> </configuration>
</plugin> </plugin>

View File

@ -4,10 +4,11 @@
<outputDirectory>/lib</outputDirectory> <outputDirectory>/lib</outputDirectory>
<useTransitiveDependencies>true</useTransitiveDependencies> <useTransitiveDependencies>true</useTransitiveDependencies>
<useTransitiveFiltering>false</useTransitiveFiltering> <useTransitiveFiltering>false</useTransitiveFiltering>
<useProjectArtifact>false</useProjectArtifact>
<excludes> <excludes>
<!-- don't include our POMs etc that we use internally --> <!-- don't include our POMs etc that we use internally -->
<!-- otherwise, don't filter here. mark deps properly instead --> <!-- otherwise, don't filter here. mark deps properly instead -->
<exclude>org.elasticsearch.distribution:*</exclude> <exclude>*:pom</exclude>
</excludes> </excludes>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>

View File

@ -9,13 +9,19 @@
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>elasticsearch-tar</artifactId> <groupId>org.elasticsearch.distribution.tar</groupId>
<artifactId>elasticsearch</artifactId>
<name>Elasticsearch TAR Distribution</name> <name>Elasticsearch TAR Distribution</name>
<!--
We should use pom packaging here because we don't want to publish any jar.
But if you do this, then maven lifecycle does not execute any test (nor compile any test)
-->
<!--packaging>pom</packaging-->
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.elasticsearch.distribution</groupId> <groupId>org.elasticsearch.distribution.fully-loaded</groupId>
<artifactId>elasticsearch-fully-loaded</artifactId> <artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version> <version>${elasticsearch.version}</version>
<type>pom</type> <type>pom</type>
</dependency> </dependency>

View File

@ -9,13 +9,19 @@
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>elasticsearch-zip</artifactId> <groupId>org.elasticsearch.distribution.zip</groupId>
<artifactId>elasticsearch</artifactId>
<name>Elasticsearch ZIP Distribution</name> <name>Elasticsearch ZIP Distribution</name>
<!--
We should use pom packaging here because we don't want to publish any jar.
But if you do this, then maven lifecycle does not execute any test (nor compile any test)
-->
<!--packaging>pom</packaging-->
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.elasticsearch.distribution</groupId> <groupId>org.elasticsearch.distribution.fully-loaded</groupId>
<artifactId>elasticsearch-fully-loaded</artifactId> <artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version> <version>${elasticsearch.version}</version>
<type>pom</type> <type>pom</type>
</dependency> </dependency>

View File

@ -905,7 +905,7 @@
<!-- some infos https://github.com/tcurdt/jdeb/blob/master/docs/maven.md --> <!-- some infos https://github.com/tcurdt/jdeb/blob/master/docs/maven.md -->
<groupId>org.vafer</groupId> <groupId>org.vafer</groupId>
<artifactId>jdeb</artifactId> <artifactId>jdeb</artifactId>
<version>1.3</version> <version>1.4</version>
<extensions>true</extensions> <extensions>true</extensions>
</plugin> </plugin>
<plugin> <plugin>