Author: massi
Date: Wed Oct 1 12:03:01 2014
New Revision: 1628683
URL: http://svn.apache.org/r1628683
Log:
merge from branch 1_2_X
Modified:
syncope/trunk/ (props changed)
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/InstallLog.java
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java
Propchange: syncope/trunk/
------------------------------------------------------------------------------
Merged /syncope/branches/1_2_X:r1628459-1628682
Modified:
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java?rev=1628683&r1=1628682&r2=1628683&view=diff
==============================================================================
---
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
(original)
+++
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
Wed Oct 1 12:03:01 2014
@@ -92,6 +92,9 @@ public class ArchetypeProcess {
InstallLog.getInstance().error(messageError.append(ex.getMessage()
== null ? "" : ex.getMessage()).
toString());
}
+ handler.logOutput("########################## IMPORTANT
##########################", true);
+ handler.logOutput("See " +
InstallLog.getInstance().getFileAbsolutePath() + " for the maven logs", true);
+ handler.logOutput("########################## IMPORTANT
##########################", true);
mavenUtils.archetypeGenerate(
syncopeVersion, groupId, artifactId, secretKey, anonymousKey,
installPath, customMavenProxySettings);
Modified:
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/InstallLog.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/InstallLog.java?rev=1628683&r1=1628682&r2=1628683&view=diff
==============================================================================
---
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/InstallLog.java
(original)
+++
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/InstallLog.java
Wed Oct 1 12:03:01 2014
@@ -30,8 +30,11 @@ public class InstallLog {
private final FileSystemUtils fileSystemUtils;
+ private final String fileAbsolutePath;
+
private InstallLog(final String installPath, final
AbstractUIProcessHandler handler) {
- log = new File(installPath + "/install.log");
+ fileAbsolutePath = installPath + "/install.log";
+ log = new File(fileAbsolutePath);
fileSystemUtils = new FileSystemUtils(handler);
}
@@ -56,6 +59,10 @@ public class InstallLog {
writeToFile("Info", msg);
}
+ public String getFileAbsolutePath() {
+ return fileAbsolutePath;
+ }
+
private void writeToFile(final String what, final String msg) {
fileSystemUtils.appendToFile(log, new Date() + " | " + what + ": " +
msg);
}
Modified:
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java?rev=1628683&r1=1628682&r2=1628683&view=diff
==============================================================================
---
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java
(original)
+++
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java
Wed Oct 1 12:03:01 2014
@@ -20,8 +20,10 @@ package org.apache.syncope.installer.uti
import com.izforge.izpack.panels.process.AbstractUIProcessHandler;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -37,6 +39,8 @@ import org.apache.maven.shared.invoker.I
import org.apache.maven.shared.invoker.InvocationResult;
import org.apache.maven.shared.invoker.Invoker;
import org.apache.maven.shared.invoker.MavenInvocationException;
+import org.apache.maven.shared.invoker.PrintStreamHandler;
+import org.apache.maven.shared.invoker.PrintStreamLogger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
@@ -61,8 +65,8 @@ public class MavenUtils {
final InvocationRequest request = new DefaultInvocationRequest();
request.setGoals(Collections.singletonList("archetype:generate"));
request.setInteractive(false);
- final Properties properties =
- archetypeProperties(archetypeVersion, groupId, artifactId,
secretKey, anonymousKey);
+ final Properties properties
+ = archetypeProperties(archetypeVersion, groupId, artifactId,
secretKey, anonymousKey);
request.setProperties(properties);
if (customSettingsFile != null && FileUtils.sizeOf(customSettingsFile)
> 0) {
request.setUserSettingsFile(customSettingsFile);
@@ -99,7 +103,7 @@ public class MavenUtils {
logToFile(request.getGoals(), new Properties());
invoke(request, path);
}
-
+
public void mvnCleanPackageWithProperties(final String path, final String
confDirectory,
final String logDirectory, final String bundlesDirectory, final
File customSettingsFile) {
final InvocationRequest request = new DefaultInvocationRequest();
@@ -153,14 +157,21 @@ public class MavenUtils {
private InvocationResult invoke(final InvocationRequest request, final
String path) {
InvocationResult result = null;
final Invoker invoker = new DefaultInvoker();
- invoker.setOutputHandler(null);
- invoker.setWorkingDirectory(new File(path));
try {
+ invoker.setLogger( new PrintStreamLogger(
+ new
PrintStream(InstallLog.getInstance().getFileAbsolutePath()), 1000));
+ invoker.setOutputHandler(new PrintStreamHandler(
+ new
PrintStream(InstallLog.getInstance().getFileAbsolutePath()), true));
+ invoker.setWorkingDirectory(new File(path));
result = invoker.execute(request);
} catch (MavenInvocationException ex) {
final String messageError = "Maven exception: " + ex.getMessage();
handler.emitError(messageError, messageError);
InstallLog.getInstance().info(messageError);
+ } catch (FileNotFoundException ex) {
+ final String messageError = "Maven exception: " + ex.getMessage();
+ handler.emitError(messageError, messageError);
+ InstallLog.getInstance().info(messageError);
}
return result;
}