From f9d1db6366bbd05ada2ed9b180c8052480a5b3e1 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Tue, 17 May 2016 14:59:06 +0200 Subject: [PATCH] Force attach a fake jar with non "jar" artifacts Follow up for #18396: which is reverted with this change When you upload any `jar` artifact you have to provide the `jar` file, javadocs and sources. For distribution, we changed from `pom` artifact to `jar` in order to be able to run integration tests. But we never generate any jar, sources or javadoc because they don't exist. This PR adds a FAKE file in `src/main/resources`. So Maven is able to generate the JAR file which is uploaded to Sonatype. Sources are then automatically added. To generate the javadoc file, we need also to tell maven that javadoc will be based on this `src/main/resources` dir. As a file exists in it, javadoc is generated as well. ``` [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ elasticsearch --- [INFO] Installing /Users/dpilato/Documents/Elasticsearch/dev/es-2x/elasticsearch/distribution/zip/target/elasticsearch-2.4.0-SNAPSHOT.jar to /Users/dpilato/.m2/repository/org/elasticsearch/distribution/zip/elasticsearch/2.4.0-SNAPSHOT/elasticsearch-2.4.0-SNAPSHOT.jar [INFO] Installing /Users/dpilato/Documents/Elasticsearch/dev/es-2x/elasticsearch/distribution/zip/pom.xml to /Users/dpilato/.m2/repository/org/elasticsearch/distribution/zip/elasticsearch/2.4.0-SNAPSHOT/elasticsearch-2.4.0-SNAPSHOT.pom [INFO] Installing /Users/dpilato/Documents/Elasticsearch/dev/es-2x/elasticsearch/distribution/zip/target/elasticsearch-2.4.0-SNAPSHOT-javadoc.jar to /Users/dpilato/.m2/repository/org/elasticsearch/distribution/zip/elasticsearch/2.4.0-SNAPSHOT/elasticsearch-2.4.0-SNAPSHOT-javadoc.jar [INFO] Installing /Users/dpilato/Documents/Elasticsearch/dev/es-2x/elasticsearch/distribution/zip/target/elasticsearch-2.4.0-SNAPSHOT-sources.jar to /Users/dpilato/.m2/repository/org/elasticsearch/distribution/zip/elasticsearch/2.4.0-SNAPSHOT/elasticsearch-2.4.0-SNAPSHOT-sources.jar [INFO] Installing /Users/dpilato/Documents/Elasticsearch/dev/es-2x/elasticsearch/distribution/zip/target/releases/elasticsearch-2.4.0-SNAPSHOT.zip to /Users/dpilato/.m2/repository/org/elasticsearch/distribution/zip/elasticsearch/2.4.0-SNAPSHOT/elasticsearch-2.4.0-SNAPSHOT.zip ``` --- distribution/deb/src/main/resources/FAKE.txt | 3 +++ .../src/main/resources/FAKE.txt | 3 +++ distribution/pom.xml | 21 ++++++++++++++---- distribution/tar/src/main/resources/FAKE.txt | 3 +++ distribution/zip/src/main/resources/FAKE.txt | 3 +++ plugins/site-example/pom.xml | 22 ++++++++++--------- .../site-example/src/main/resources/FAKE.txt | 3 +++ 7 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 distribution/deb/src/main/resources/FAKE.txt create mode 100644 distribution/integ-test-zip/src/main/resources/FAKE.txt create mode 100644 distribution/tar/src/main/resources/FAKE.txt create mode 100644 distribution/zip/src/main/resources/FAKE.txt create mode 100644 plugins/site-example/src/main/resources/FAKE.txt diff --git a/distribution/deb/src/main/resources/FAKE.txt b/distribution/deb/src/main/resources/FAKE.txt new file mode 100644 index 0000000000000..2f744da3a741f --- /dev/null +++ b/distribution/deb/src/main/resources/FAKE.txt @@ -0,0 +1,3 @@ +This file is used to generate a FAKE jar which is needed by Sonatype +to validate the artifact. + diff --git a/distribution/integ-test-zip/src/main/resources/FAKE.txt b/distribution/integ-test-zip/src/main/resources/FAKE.txt new file mode 100644 index 0000000000000..2f744da3a741f --- /dev/null +++ b/distribution/integ-test-zip/src/main/resources/FAKE.txt @@ -0,0 +1,3 @@ +This file is used to generate a FAKE jar which is needed by Sonatype +to validate the artifact. + diff --git a/distribution/pom.xml b/distribution/pom.xml index 35b356feeca7e..e2baba94692fb 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -149,12 +149,25 @@ + org.apache.maven.plugins - maven-source-plugin - - true - + maven-jar-plugin + + + empty-javadoc-jar + package + + jar + + + javadoc + ${basedir}/src/main/resources + + + diff --git a/distribution/tar/src/main/resources/FAKE.txt b/distribution/tar/src/main/resources/FAKE.txt new file mode 100644 index 0000000000000..2f744da3a741f --- /dev/null +++ b/distribution/tar/src/main/resources/FAKE.txt @@ -0,0 +1,3 @@ +This file is used to generate a FAKE jar which is needed by Sonatype +to validate the artifact. + diff --git a/distribution/zip/src/main/resources/FAKE.txt b/distribution/zip/src/main/resources/FAKE.txt new file mode 100644 index 0000000000000..2f744da3a741f --- /dev/null +++ b/distribution/zip/src/main/resources/FAKE.txt @@ -0,0 +1,3 @@ +This file is used to generate a FAKE jar which is needed by Sonatype +to validate the artifact. + diff --git a/plugins/site-example/pom.xml b/plugins/site-example/pom.xml index 2f4aeac7045a1..35094cb76b07e 100644 --- a/plugins/site-example/pom.xml +++ b/plugins/site-example/pom.xml @@ -27,14 +27,6 @@ - - org.apache.maven.plugins - maven-source-plugin - - true - - - org.apache.maven.plugins maven-assembly-plugin @@ -44,9 +36,19 @@ org.apache.maven.plugins maven-jar-plugin + - default-jar - none + empty-javadoc-jar + package + + jar + + + javadoc + ${basedir}/src/main/resources + diff --git a/plugins/site-example/src/main/resources/FAKE.txt b/plugins/site-example/src/main/resources/FAKE.txt new file mode 100644 index 0000000000000..2f744da3a741f --- /dev/null +++ b/plugins/site-example/src/main/resources/FAKE.txt @@ -0,0 +1,3 @@ +This file is used to generate a FAKE jar which is needed by Sonatype +to validate the artifact. +