props.setProperty("classifier", "app");
props.setProperty("packaging", "zip");
request.setProperties(props);
getLog().info("Installing aggregated zip using: mvn install:install-file" + serializeMvnProperties(props));
Invoker invoker = new DefaultInvoker();
try {
InvocationResult result = invoker.execute(request);
if (result.getExitCode() != 0) {
throw new IllegalStateException("Error invoking Maven goal install:install-file");
}
} catch (MavenInvocationException e) {
throw new MojoExecutionException("Error invoking Maven goal install:install-file", e);
}
}
if (rootProject.hasLifecyclePhase("deploy")) {
getLog().info("Deploying aggregated zip " + projectOutputFile + " to root project " + rootProject.getArtifactId());
InvocationRequest request = new DefaultInvocationRequest();
request.setBaseDirectory(rootProject.getBasedir());
request.setPomFile(new File("./pom.xml"));
request.setGoals(Collections.singletonList("deploy:deploy-file"));
request.setRecursive(false);
request.setInteractive(false);
Properties props = new Properties();
props.setProperty("file", aggregatedZipFileName);
props.setProperty("groupId", rootProjectGroupId);
props.setProperty("artifactId", rootProjectArtifactId);
props.setProperty("version", rootProjectVersion);
props.setProperty("classifier", "app");
props.setProperty("packaging", "zip");
props.setProperty("url", deploymentRepository.getUrl());
props.setProperty("repositoryId", deploymentRepository.getId());
request.setProperties(props);
getLog().info("Deploying aggregated zip using: mvn deploy:deploy-file" + serializeMvnProperties(props));
Invoker invoker = new DefaultInvoker();
try {
InvocationResult result = invoker.execute(request);
if (result.getExitCode() != 0) {
throw new IllegalStateException("Error invoking Maven goal deploy:deploy-file");
}
} catch (MavenInvocationException e) {
throw new MojoExecutionException("Error invoking Maven goal deploy:deploy-file", e);