Skip to content

Commit 8956651

Browse files
author
Erwin Tratar
committed
testcase for useDefaultManifestFile added
1 parent 6b4f6e7 commit 8956651

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project>
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>org.sonatype.m2e.mavenarchiver.tests</groupId>
5+
<artifactId>mavenarchiver-p006</artifactId>
6+
<version>1.0.0-SNAPSHOT</version>
7+
<build>
8+
<plugins>
9+
<plugin>
10+
<artifactId>maven-compiler-plugin</artifactId>
11+
<version>2.0.2</version>
12+
</plugin>
13+
<plugin>
14+
<artifactId>maven-jar-plugin</artifactId>
15+
<version>2.2</version>
16+
<configuration>
17+
<useDefaultManifestFile>true</useDefaultManifestFile>
18+
</configuration>
19+
</plugin>
20+
<plugin>
21+
<artifactId>maven-resources-plugin</artifactId>
22+
<version>2.4.1</version>
23+
</plugin>
24+
<plugin>
25+
<artifactId>maven-surefire-plugin</artifactId>
26+
<version>2.4.3</version>
27+
</plugin>
28+
</plugins>
29+
</build>
30+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Built-By: You know who
2+
Class-Path: custom.jar

org.sonatype.m2e.mavenarchiver.tests/src/org/sonatype/m2e/mavenarchiver/MavenArchiverTest.java

+21-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.eclipse.core.resources.IncrementalProjectBuilder;
1212
import org.eclipse.core.runtime.CoreException;
1313
import org.eclipse.core.runtime.IPath;
14-
import org.eclipse.core.runtime.NullProgressMonitor;
1514
import org.eclipse.m2e.core.MavenPlugin;
1615
import org.eclipse.m2e.core.embedder.ArtifactKey;
1716
import org.eclipse.m2e.core.internal.IMavenConstants;
@@ -243,6 +242,27 @@ private void _testProvidedManifest(String pomLocation) throws Exception
243242
assertTrue("Invalid Classpath in manifest : " + manifest, manifest.contains("Class-Path: custom.jar"));
244243
}
245244

245+
@Test
246+
public void test006_UseDefaultManifestFile() throws Exception
247+
{
248+
IProject project = importProject("projects/mavenarchiver/mavenarchiver-p006/pom.xml");
249+
waitForJobsToComplete();
250+
251+
IFile manifestFile = project.getFile("src/main/resources/META-INF/MANIFEST.MF");
252+
assertTrue("The manifest was deleted", manifestFile.exists());
253+
254+
// trigger a full build
255+
project.build( IncrementalProjectBuilder.FULL_BUILD, monitor );
256+
waitForJobsToComplete();
257+
assertNoErrors(project);
258+
259+
IFile generatedManifestFile = project.getFile("target/classes/META-INF/MANIFEST.MF");
260+
assertTrue("A manifest is missing", generatedManifestFile.exists());
261+
262+
String manifest =getAsString(generatedManifestFile);
263+
assertTrue("Built-By is invalid:"+manifest, manifest.contains("Built-By: You know who"));
264+
}
265+
246266
public void testMECLIPSEWTP163_ParentMustBeResolved()
247267
throws Exception
248268
{

0 commit comments

Comments
 (0)