[
https://issues.jboss.org/browse/SHRINKWRAP-325?page=com.atlassian.jira.pl...
]
Geoffrey De Smet commented on SHRINKWRAP-325:
---------------------------------------------
Here's what I am using now, directly in my webapp module:
{code}
@Deployment
public static WebArchive createDeployment() {
// TODO FIXME do not hardcode the version number
WebArchive webArchive = ShrinkWrap.create(ExplodedImporter.class,
"guvnor-webapp-5.3.0-SNAPSHOT.war")
.importDirectory(new
File("target/guvnor-webapp-5.3.0-SNAPSHOT/"))
.as(WebArchive.class)
.addAsResource(new File("target/test-classes/"),
ArchivePaths.create(""))
.addAsLibraries(
DependencyResolvers.use(MavenDependencyResolver.class)
.includeDependenciesFromPom("pom.xml")
.resolveAsFiles(new ScopeFilter("test")));
return webArchive;
}
{code}
but if there was a facade method like this pseudo code, it would be better:
{code}
public WebArchive mavenWarFacade(String pomFilePath) {
WebArchive webArchive = ShrinkWrap.create(ExplodedImporter.class,
extractStringFromPom(pomFilePath, "${project.build.finalName}") +
".war")
.importDirectory(extractFileFromPom("${project.build.directory}/${project.build.finalName}"))
.as(WebArchive.class)
.addAsResource(extractFileFromPom(pomFilePath,
"${project.build.testOutputDir}"), ArchivePaths.create(""))
.addAsLibraries(
DependencyResolvers.use(MavenDependencyResolver.class)
.includeDependenciesFromPom(pomFilePath)
.resolveAsFiles(new ScopeFilter("test")));
return webArchive;
}
{code}
Both maven and intellij build correctly to
${project.build.directory}/${project.build.finalName} afaik.
Maven based shrinkwrap WebArchive creator that adds all WEB-INF
descriptors, classes, test classes and webapp resources too (not just dependencies and
test dependencies)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: SHRINKWRAP-325
URL:
https://issues.jboss.org/browse/SHRINKWRAP-325
Project: ShrinkWrap
Issue Type: Feature Request
Reporter: Geoffrey De Smet
Assignee: Karel Piwko
Priority: Critical
The MavenDependencyResolver is nice, but it does only half the job.
We still have to manually add "target/guvnor-webapp-5.3.0-SNAPSHOT/"
or "target/classes" and "target/test-classes" and
"src/webapp/WEB-INF/*" files etc.
But all that info is in the pom model, so it would be nice to have a feature as a facade
for that.
Something like
{code}
ShrinkWrap.createEntirelyFromMavenPom("pom.xml", includeEntireTestClasspath).
{code}
Note that it can include the entire test classpath (for helper classes under
"target/test-classes" and dependencies such as Mockito).
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira