Skip to content

Commit

Permalink
Handle projpack return code
Browse files Browse the repository at this point in the history
  • Loading branch information
Rathna Natarajan committed Apr 11, 2019
1 parent 1fb299c commit 401526d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<modelVersion>4.0.0</modelVersion>

<groupId>com.axway</groupId>
<artifactId>fed-archive</artifactId>
<version>1.0-SNAPSHOT</version>
<artifactId>policy-archive</artifactId>
<version>1.0.0</version>
<packaging>maven-plugin</packaging>

<name>fed-archive Maven Plugin</name>
Expand Down
28 changes: 16 additions & 12 deletions src/main/java/com/axway/AbstractGatewayPackage.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public abstract class AbstractGatewayPackage extends AbstractMojo {

public AbstractGatewayPackage() {
// TODO Auto-generated constructor stub

}

protected abstract String packageType();
Expand All @@ -60,7 +59,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
try {

String type = packageType();

File outputFolder = new File(targetFolder, "axway");
outputFolder.mkdir();

Expand Down Expand Up @@ -106,22 +105,30 @@ public void execute() throws MojoExecutionException, MojoFailureException {
} finally {
br.close();
}

String generatedFile = targetFolder.getPath()+File.separator+name;

int status = process.waitFor();
log.info("Status value " + status);
if (status == 0) {

log.info("Exit value " + process.exitValue());
if (process.exitValue() != 0) {
throw new MojoFailureException("Error with projpack");
}

} else {
throw new MojoFailureException("Error with projpack");
}
String generatedFile = targetFolder.getPath()+File.separator+name;
File artifact = new File(generatedFile+"."+type);

log.info("Output path" + artifact.getPath());

project.getArtifact().setFile(artifact);
log.info("Packaging complete");

} catch (Exception e) {
log.error(e);
throw new MojoFailureException("Error with projpack :"+e.getMessage());

}

log.info("Deployment Complete....");
log.info("projpack Complete....");
}

private String extractJar(File filename, File destDir) throws IOException {
Expand Down Expand Up @@ -150,11 +157,8 @@ private String extractJar(File filename, File destDir) throws IOException {
}
fileOutputStream.close();
inputStream.close();

}

jarFile.close();

return destDir.getAbsolutePath();
}

Expand Down

0 comments on commit 401526d

Please sign in to comment.