From 9ec001be1d6332e27929b2a5781beee19d344aa5 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Tue, 17 May 2016 12:06:35 +0200 Subject: [PATCH] Force attach sources with non "jar" artifacts Sonatype rule `sources-staging` force to provide a `*-sources.jar` artifact. This PR generates the source jar even if there is no related java code by considering the `pom.xml` file as a source file. We could set this globally on the project but I prefer being cautious here and just add this to the projects which are not generating source files archive for now. When you run it on distribution packages or site-example plugin, you now get: ``` [INFO] --- maven-source-plugin:2.4:jar (attach-sources) @ site-example --- [INFO] Building jar: /Users/dpilato/Documents/Elasticsearch/dev/es-2x/elasticsearch/plugins/site-example/target/site-example-2.4.0-SNAPSHOT-sources.jar ``` Was previously: ``` [INFO] --- maven-source-plugin:2.4:jar (attach-sources) @ site-example --- [INFO] No sources in project. Archive not created. ``` --- distribution/pom.xml | 8 ++++++++ plugins/site-example/pom.xml | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/distribution/pom.xml b/distribution/pom.xml index 970dd76b7fe4c..35b356feeca7e 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -149,6 +149,14 @@ + + org.apache.maven.plugins + maven-source-plugin + + true + + + org.apache.maven.plugins diff --git a/plugins/site-example/pom.xml b/plugins/site-example/pom.xml index 95824976b6a3d..2f4aeac7045a1 100644 --- a/plugins/site-example/pom.xml +++ b/plugins/site-example/pom.xml @@ -27,6 +27,14 @@ + + org.apache.maven.plugins + maven-source-plugin + + true + + + org.apache.maven.plugins maven-assembly-plugin