Thomas Vachuska
Committed by Brian O'Connor

Fixed a defect on OnosAppMojo to allow apps to properly stage their own artifacts.

Change-Id: Iea33baec27820663524ba84524ff9acb40d7a9b3
...@@ -225,21 +225,21 @@ public class OnosAppMojo extends AbstractMojo { ...@@ -225,21 +225,21 @@ public class OnosAppMojo extends AbstractMojo {
225 } 225 }
226 226
227 // Stages all artifacts. 227 // Stages all artifacts.
228 - private void processArtifacts() { 228 + private void processArtifacts() throws MojoExecutionException {
229 - artifacts.forEach(this::processArtifact); 229 + for (String artifact : artifacts) {
230 + processArtifact(artifact);
231 + }
230 } 232 }
231 233
232 // Stages the specified artifact. 234 // Stages the specified artifact.
233 - private void processArtifact(String artifact) { 235 + private void processArtifact(String artifact) throws MojoExecutionException {
234 if (!artifact.startsWith(MVN_URL)) { 236 if (!artifact.startsWith(MVN_URL)) {
235 - getLog().error("Unsupported artifact URL:" + artifact); 237 + throw new MojoExecutionException("Unsupported artifact URL:" + artifact);
236 - return;
237 } 238 }
238 239
239 String[] fields = artifact.substring(4).split("/"); 240 String[] fields = artifact.substring(4).split("/");
240 if (fields.length < 3) { 241 if (fields.length < 3) {
241 - getLog().error("Illegal artifact URL:" + artifact); 242 + throw new MojoExecutionException("Illegal artifact URL:" + artifact);
242 - return;
243 } 243 }
244 244
245 try { 245 try {
...@@ -254,12 +254,12 @@ public class OnosAppMojo extends AbstractMojo { ...@@ -254,12 +254,12 @@ public class OnosAppMojo extends AbstractMojo {
254 // Other artifacts are packaged from ~/.m2/repository directory. 254 // Other artifacts are packaged from ~/.m2/repository directory.
255 String m2Path = artifactDir(fields); 255 String m2Path = artifactDir(fields);
256 File srcDir = new File(m2Directory, m2Path); 256 File srcDir = new File(m2Directory, m2Path);
257 - File dstDir = new File(stageDirectory, m2Path); 257 + File dstDir = new File(stageDirectory, M2_PREFIX + "/" + m2Path);
258 forceMkdir(dstDir); 258 forceMkdir(dstDir);
259 copyFile(new File(srcDir, file), new File(dstDir, file)); 259 copyFile(new File(srcDir, file), new File(dstDir, file));
260 } 260 }
261 } catch (IOException e) { 261 } catch (IOException e) {
262 - getLog().error("Unable to stage artifact " + artifact + " due to ", e); 262 + throw new MojoExecutionException("Unable to stage artifact " + artifact, e);
263 } 263 }
264 } 264 }
265 265
......