Skip to content
Snippets Groups Projects
Commit 25536ad6 authored by Thomas Mortagne's avatar Thomas Mortagne
Browse files

[misc] Fix error reporting

parent 7303d8f7
No related branches found
No related tags found
No related merge requests found
...@@ -95,7 +95,7 @@ public class PackageMojo extends AbstractOldCoreMojo ...@@ -95,7 +95,7 @@ public class PackageMojo extends AbstractOldCoreMojo
private File outputClassesDirectory; private File outputClassesDirectory;
/** /**
* Used to look up Artifacts in the remote repository. * * Used to look up Artifacts in the remote repository.
*/ */
@Component @Component
protected RepositorySystem repositorySystem; protected RepositorySystem repositorySystem;
...@@ -606,7 +606,7 @@ private Set<Artifact> getMandatoryJarArtifacts() throws MojoExecutionException ...@@ -606,7 +606,7 @@ private Set<Artifact> getMandatoryJarArtifacts() throws MojoExecutionException
// Required to load macros.vm by default // Required to load macros.vm by default
mandatoryTopLevelArtifacts.add(this.repositorySystem.createArtifact("org.xwiki.platform", mandatoryTopLevelArtifacts.add(this.repositorySystem.createArtifact("org.xwiki.platform",
"xwiki-platform-velocity-webapp", getXWikiPlatformVersion(), null, "jar")); "xwiki-platform-velocity-webapp", getXWikiPlatformVersion(), null, "jar"));
// Required Plugins // Required Plugins
mandatoryTopLevelArtifacts.add(this.repositorySystem.createArtifact("org.xwiki.platform", mandatoryTopLevelArtifacts.add(this.repositorySystem.createArtifact("org.xwiki.platform",
...@@ -759,8 +759,8 @@ private Set<Artifact> resolveTransitively(Set<Artifact> artifacts) throws MojoEx ...@@ -759,8 +759,8 @@ private Set<Artifact> resolveTransitively(Set<Artifact> artifacts) throws MojoEx
.setManagedVersionMap(getManagedVersionMap()).setResolveRoot(false); .setManagedVersionMap(getManagedVersionMap()).setResolveRoot(false);
ArtifactResolutionResult resolutionResult = this.repositorySystem.resolve(request); ArtifactResolutionResult resolutionResult = this.repositorySystem.resolve(request);
if (resolutionResult.hasExceptions()) { if (resolutionResult.hasExceptions()) {
throw new MojoExecutionException( throw new MojoExecutionException(String.format("Failed to resolve artifacts [%s]", artifacts),
String.format("Failed to resolve artifacts [%s]", artifacts, resolutionResult.getExceptions().get(0))); resolutionResult.getExceptions().get(0));
} }
return resolutionResult.getArtifacts(); return resolutionResult.getArtifacts();
...@@ -855,7 +855,7 @@ private void copyDirectory(File sourceDirectory, File targetDirectory) throws Mo ...@@ -855,7 +855,7 @@ private void copyDirectory(File sourceDirectory, File targetDirectory) throws Mo
FileUtils.copyDirectoryStructureIfModified(sourceDirectory, targetDirectory); FileUtils.copyDirectoryStructureIfModified(sourceDirectory, targetDirectory);
} catch (IOException e) { } catch (IOException e) {
throw new MojoExecutionException( throw new MojoExecutionException(
String.format("Failed to copy directory [%] to [%]", sourceDirectory, targetDirectory), e); String.format("Failed to copy directory [%s] to [%s]", sourceDirectory, targetDirectory), e);
} }
} }
...@@ -864,7 +864,7 @@ private void copyFile(File source, File targetDirectory) throws MojoExecutionExc ...@@ -864,7 +864,7 @@ private void copyFile(File source, File targetDirectory) throws MojoExecutionExc
try { try {
FileUtils.copyFileToDirectoryIfModified(source, targetDirectory); FileUtils.copyFileToDirectoryIfModified(source, targetDirectory);
} catch (IOException e) { } catch (IOException e) {
throw new MojoExecutionException(String.format("Failed to copy file [%] to [%]", source, targetDirectory), throw new MojoExecutionException(String.format("Failed to copy file [%s] to [%s]", source, targetDirectory),
e); e);
} }
} }
...@@ -903,8 +903,8 @@ private void resolveArtifact(Artifact artifact) throws MojoExecutionException ...@@ -903,8 +903,8 @@ private void resolveArtifact(Artifact artifact) throws MojoExecutionException
.setRemoteRepositories(this.remoteRepositories).setLocalRepository(this.localRepository); .setRemoteRepositories(this.remoteRepositories).setLocalRepository(this.localRepository);
ArtifactResolutionResult resolutionResult = this.repositorySystem.resolve(request); ArtifactResolutionResult resolutionResult = this.repositorySystem.resolve(request);
if (resolutionResult.hasExceptions()) { if (resolutionResult.hasExceptions()) {
throw new MojoExecutionException( throw new MojoExecutionException(String.format("Failed to resolve artifact [%s]", artifact),
String.format("Failed to resolve artifact [%s]", artifact, resolutionResult.getExceptions().get(0))); resolutionResult.getExceptions().get(0));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment