Added version check to choose right repository. Fixed #SYNCOPE-575

Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/c5439d1f
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/c5439d1f
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/c5439d1f

Branch: refs/heads/master
Commit: c5439d1f286b31a2b036468342a9e039bbdbcefa
Parents: c6adbef
Author: massi <massimiliano.perr...@tirasa.net>
Authored: Wed Oct 22 17:49:27 2014 +0200
Committer: massi <massimiliano.perr...@tirasa.net>
Committed: Wed Oct 22 17:49:27 2014 +0200

----------------------------------------------------------------------
 .../syncope/installer/processes/ArchetypeProcess.java       | 9 ++++++---
 .../org/apache/syncope/installer/utilities/MavenUtils.java  | 8 ++++++--
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/c5439d1f/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
----------------------------------------------------------------------
diff --git 
a/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
 
b/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
index c96f1ee..45569e7 100644
--- 
a/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
+++ 
b/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
@@ -97,9 +97,12 @@ public class ArchetypeProcess {
         handler.logOutput("########################## IMPORTANT 
##########################", true);
         mavenUtils.archetypeGenerate(
                 syncopeVersion, groupId, artifactId, secretKey, anonymousKey, 
installPath, customMavenProxySettings);
-
-        fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + 
ParentPom.PATH),
-                String.format(ParentPom.FILE, syncopeVersion, syncopeVersion, 
groupId, artifactId));
+        
+        if (syncopeVersion.contains("SNAPSHOT")) {
+            fileSystemUtils.writeToFile(new File(installPath + "/" + 
artifactId + ParentPom.PATH),
+                    String.format(ParentPom.FILE, syncopeVersion, 
syncopeVersion, groupId, artifactId));
+        }
+        
         fileSystemUtils.createDirectory(confDirectory);
         fileSystemUtils.createDirectory(logsDirectory);
         fileSystemUtils.createDirectory(bundlesDirectory);

http://git-wip-us.apache.org/repos/asf/syncope/blob/c5439d1f/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java
----------------------------------------------------------------------
diff --git 
a/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java
 
b/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java
index 1531b63..e842ea7 100644
--- 
a/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java
+++ 
b/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java
@@ -81,7 +81,11 @@ public class MavenUtils {
         final Properties properties = new Properties();
         properties.setProperty("archetypeGroupId", "org.apache.syncope");
         properties.setProperty("archetypeArtifactId", "syncope-archetype");
-        properties.setProperty("archetypeRepository", 
"http://repository.apache.org/content/repositories/snapshots";);
+        if (archetypeVersion.contains("SNAPSHOT")) {
+            properties.setProperty("archetypeRepository", 
"http://repository.apache.org/content/repositories/snapshots";);
+        } else {
+            properties.setProperty("archetypeRepository", 
"http://repo1.maven.org/maven2";);
+        }
         properties.setProperty("archetypeVersion", archetypeVersion);
         properties.setProperty("groupId", groupId);
         properties.setProperty("artifactId", artifactId);
@@ -158,7 +162,7 @@ public class MavenUtils {
         InvocationResult result = null;
         final Invoker invoker = new DefaultInvoker();
         try {
-            invoker.setLogger( new PrintStreamLogger(
+            invoker.setLogger(new PrintStreamLogger(
                     new 
PrintStream(InstallLog.getInstance().getFileAbsolutePath()), 1000));
             invoker.setOutputHandler(new PrintStreamHandler(
                     new 
PrintStream(InstallLog.getInstance().getFileAbsolutePath()), true));

Reply via email to