You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by pt...@apache.org on 2018/05/25 10:50:20 UTC

[maven-archetype] branch master updated: ARCHETYPE-530 Pass the settings.xml file to the ArchetypeCreationRequest.

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

ptahchiev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-archetype.git


The following commit(s) were added to refs/heads/master by this push:
     new d385707  ARCHETYPE-530 Pass the settings.xml file to the ArchetypeCreationRequest.
d385707 is described below

commit d385707bf67cc9b82f0ba1070a3b5c1131f4b6cb
Author: petar.tahchiev <pa...@gmail.com>
AuthorDate: Fri May 25 12:52:13 2018 +0300

    ARCHETYPE-530 Pass the settings.xml file to the ArchetypeCreationRequest.
    
    If the user has specified settings.xml file on the command-line we need to pass it
    to the ArchetypeCreationRequest and further down the InvocationRequest. Otherwise
    postPhase like deploy will not work with custom settings.xml
    
    See ARCHETYPE-530
---
 .../apache/maven/archetype/ArchetypeCreationRequest.java   | 14 ++++++++++++++
 .../maven/archetype/creator/FilesetArchetypeCreator.java   |  1 +
 .../archetype/mojos/CreateArchetypeFromProjectMojo.java    |  5 ++++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java
index c5cc23a..ae88355 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java
@@ -59,6 +59,8 @@ public class ArchetypeCreationRequest
 
     private File outputDirectory;
 
+    private File settingsFile;
+
     public String getPostPhase()
     {
         return postPhase;
@@ -226,4 +228,16 @@ public class ArchetypeCreationRequest
 
         return this;
     }
+
+    public File getSettingsFile()
+    {
+        return settingsFile;
+    }
+
+    public ArchetypeCreationRequest setSettingsFile( File settingsFile )
+    {
+        this.settingsFile = settingsFile;
+
+        return this;
+    }
 }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
index f884cb4..7a87419 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
@@ -280,6 +280,7 @@ public class FilesetArchetypeCreator
             }
             InvocationRequest internalRequest = new DefaultInvocationRequest();
             internalRequest.setPomFile( archetypePomFile );
+            internalRequest.setUserSettingsFile( request.getSettingsFile() );
             internalRequest.setGoals( Collections.singletonList( request.getPostPhase() ) );
             if ( request.getLocalRepository() != null )
             {
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
index 97c7740..e3e6cf0 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
@@ -225,6 +225,9 @@ public class CreateArchetypeFromProjectMojo
     @Parameter( defaultValue = "${session}", readonly = true, required = true )
     private MavenSession session;
 
+//    @Parameter( defaultValue = "${session.settings}", readonly = true, required = true )
+//    private File settingsXml;
+
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
@@ -252,7 +255,7 @@ public class CreateArchetypeFromProjectMojo
                     keepParent ).setPartialArchetype( partialArchetype )
                 .setLocalRepository( localRepository ).setProjectBuildingRequest( session.getProjectBuildingRequest() )
                 /* this should be resolved and asked for user to verify */.setPackageName( packageName ).setPostPhase(
-                    archetypePostPhase ).setOutputDirectory( outputDirectory );
+                    archetypePostPhase ).setOutputDirectory( outputDirectory ).setSettingsFile( session.getRequest().getUserSettingsFile() );
 
             ArchetypeCreationResult result = manager.createArchetypeFromProject( request );
 

-- 
To stop receiving notification emails like this one, please contact
ptahchiev@apache.org.