use of org.apache.maven.plugins.war.stub.JarArtifactStub in project maven-plugins by apache.
the class WarDependenciesAnalysisTest method testDependencyNowProvided.
public void testDependencyNowProvided() throws Exception {
// setup test data
final String testId = "dependency-now-provided";
final ArtifactHandler artifactHandler = (ArtifactHandler) lookup(ArtifactHandler.ROLE, "jar");
ArtifactStub jarArtifact = new JarArtifactStub(getBasedir(), artifactHandler);
jarArtifact.setArtifactId("lib-test");
jarArtifact.setVersion("1.0");
ArtifactStub jarArtifact2 = new JarArtifactStub(getBasedir(), artifactHandler);
jarArtifact2.setArtifactId("lib-test");
jarArtifact2.setVersion("1.0");
jarArtifact2.setScope(Artifact.SCOPE_PROVIDED);
doTestTwiceWithUpdatedDependency(testId, new ArtifactStub[] { jarArtifact }, new ArtifactStub[] { jarArtifact2 }, new String[] { "WEB-INF/lib/lib-test-1.0.jar" }, null);
}
use of org.apache.maven.plugins.war.stub.JarArtifactStub in project maven-plugins by apache.
the class WarMojoTest method testFailOnMissingWebXmlNotSpecifiedAndServlet30Used.
public void testFailOnMissingWebXmlNotSpecifiedAndServlet30Used() throws Exception {
String testId = "SimpleWarUnderServlet30";
MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
File webAppDirectory = new File(getTestDirectory(), testId);
WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir());
String warName = "simple";
File webAppSource = createWebAppSource(testId);
File classesDir = createClassesDir(testId, true);
final ArtifactHandler artifactHandler = (ArtifactHandler) lookup(ArtifactHandler.ROLE, "jar");
JarArtifactStub jarArtifactStub = new JarArtifactStub(getBasedir(), artifactHandler);
jarArtifactStub.setFile(new File(getBasedir(), "/target/test-classes/unit/sample_wars/javax.servlet-api-3.0.1.jar"));
jarArtifactStub.setScope(Artifact.SCOPE_PROVIDED);
project.addArtifact(jarArtifactStub);
project.setArtifact(warArtifact);
project.setFile(warArtifact.getFile());
this.configureMojo(mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project);
setVariableValueToObject(mojo, "outputDirectory", outputDir);
setVariableValueToObject(mojo, "warName", warName);
mojo.execute();
// validate war file
File expectedWarFile = new File(outputDir, "simple.war");
final Map<String, JarEntry> jarContent = assertJarContent(expectedWarFile, new String[] { "META-INF/MANIFEST.MF", "pansit.jsp", "org/web/app/last-exile.jsp", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, new String[] { null, null, null, null, null });
assertFalse("web.xml should be missing", jarContent.containsKey("WEB-INF/web.xml"));
}
Aggregations