-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
3.0.0-alpha-3, 2.2.6
-
None
The recent code changes breaks Eclipse Arquillian's use of ShrinkWrap for importing *.war dependencies.
The File "root" variable gets incorrectly created for a war ("C:\dev\source\myproject\myproject-engine\target\classes" becomes "C:\dev\source\myproject\myproject-engine\target\myproject-engine-0.0.1-SNAPSHOT"), which results in the following exception being thrown
Caused by: java.lang.IllegalArgumentException: [SHRINKWRAP-93] Cannot use this JDK-based implementation to export as ZIP an archive with no content: myproject-engine-7035561881071493650.war: 0 assets
Looking at the code there seems to be a couple of issues
- If you don't build with Maven you may NOT create the war artifact in the expected location.
- If the Maven war artifact has been defined in the pom.xml with a final name it will not be found. For example -
<build> <finalName>myproject-engine</finalName> </build>
- There is no fallback mechanism, if the war build location is not found. What I think should happen is that it falls back to default classes directory (Such as when Eclipse outputs to the classes directory)
This is no such issue with shrinkwrap-resolver-impl-maven-2.2.4.jar
Code Details
- https://github.com/shrinkwrap/resolver/compare/2.2.4...2.2.6
- impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/MavenResolvedArtifactImpl.java
Details
File root = new File(artifact.getFile().getParentFile(), "target/classes"); if (!Validate.isNullOrEmpty(classifier) && "tests".equals(classifier)) { // SHRINKRES-102, allow test classes to be packaged as well root = new File(artifact.getFile().getParentFile(), "target/test-classes"); } else if ("war".equals(artifact.getProperty(ArtifactProperties.TYPE, null))) { // SHRINKRES-263, allow .war files to be packaged as well root = new File(artifact.getFile().getParentFile(), "target/" + artifactId + "-" + artifact.getVersion()); } try { File archive = File.createTempFile(artifactId + "-", "." + extension); archive.deleteOnExit(); PackageDirHelper.packageDirectories(archive, root); return archive; } catch (IOException e) { throw new IllegalArgumentException("Unable to get artifact " + artifactId + " from the classpath", e); }
This issue is related to SHRINKRES-263
- is caused by
-
SHRINKRES-263 Shrinkwrap resolver does not honor war dependencies
- Closed