You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2019/12/06 10:10:23 UTC

[maven-studies] branch maven-buildinfo-plugin updated: warn if no source information provided to rebuilders

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch maven-buildinfo-plugin
in repository https://gitbox.apache.org/repos/asf/maven-studies.git


The following commit(s) were added to refs/heads/maven-buildinfo-plugin by this push:
     new 29ba830  warn if no source information provided to rebuilders
29ba830 is described below

commit 29ba830d12fd47bbb1b5adbf53be43f5bfeef3af
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Fri Dec 6 11:10:05 2019 +0100

    warn if no source information provided to rebuilders
---
 .../apache/maven/plugins/buildinfo/SaveMojo.java   | 30 +++++++++++++++++-----
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/buildinfo/SaveMojo.java b/src/main/java/org/apache/maven/plugins/buildinfo/SaveMojo.java
index 475f36a..c701d49 100644
--- a/src/main/java/org/apache/maven/plugins/buildinfo/SaveMojo.java
+++ b/src/main/java/org/apache/maven/plugins/buildinfo/SaveMojo.java
@@ -101,13 +101,7 @@ public class SaveMojo
             p.println( "artifact-id=" + project.getArtifactId() );
             p.println( "version=" + project.getVersion() );
             p.println();
-            p.println( "# source information" );
-            p.println( "# TBD source.* artifact, url should be parameters" );
-            if ( project.getScm() != null )
-            {
-                p.println( "source.scm.uri=" + project.getScm().getConnection() );
-                p.println( "source.scm.tag=" + project.getScm().getTag() );
-            }
+            printSourceInformation( p );
             p.println();
             p.println( "# build instructions" );
             p.println( "build-tool=mvn" );
@@ -133,6 +127,28 @@ public class SaveMojo
         }
     }
 
+    private void printSourceInformation( PrintWriter p )
+    {
+        boolean sourceAvailable = false;
+        p.println( "# source information" );
+        p.println( "# TBD source.* artifact, url should be parameters" );
+        if ( project.getScm() != null )
+        {
+            sourceAvailable = true;
+            p.println( "source.scm.uri=" + project.getScm().getConnection() );
+            p.println( "source.scm.tag=" + project.getScm().getTag() );
+        }
+        else
+        {
+            p.println( "# no scm configured in pom.xml" );
+        }
+
+        if ( !sourceAvailable )
+        {
+            getLog().warn( "No source information available in buildinfo for rebuilders..." );
+        }
+    }
+
     private void printOutput( PrintWriter p )
             throws MojoExecutionException
     {