Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle <useDefaultManifestFile>true</useDefaultManifestFile> correctly #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.sonatype.m2e.mavenarchiver.tests</groupId>
<artifactId>mavenarchiver-p006</artifactId>
<version>1.0.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<useDefaultManifestFile>true</useDefaultManifestFile>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Built-By: You know who
Class-Path: custom.jar
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.ArtifactKey;
import org.eclipse.m2e.core.internal.IMavenConstants;
Expand Down Expand Up @@ -261,6 +260,27 @@ private void _testProvidedManifest(String pomLocation) throws Exception
assertTrue("Invalid Classpath in manifest : " + manifest, manifest.contains("Class-Path: custom.jar"));
}

@Test
public void test006_UseDefaultManifestFile() throws Exception
{
IProject project = importProject("projects/mavenarchiver/mavenarchiver-p006/pom.xml");
waitForJobsToComplete();

IFile manifestFile = project.getFile("src/main/resources/META-INF/MANIFEST.MF");
assertTrue("The manifest was deleted", manifestFile.exists());

// trigger a full build
project.build( IncrementalProjectBuilder.FULL_BUILD, monitor );
waitForJobsToComplete();
assertNoErrors(project);

IFile generatedManifestFile = project.getFile("target/classes/META-INF/MANIFEST.MF");
assertTrue("A manifest is missing", generatedManifestFile.exists());

String manifest =getAsString(generatedManifestFile);
assertTrue("Built-By is invalid:"+manifest, manifest.contains("Built-By: You know who"));
}

public void testMECLIPSEWTP163_ParentMustBeResolved()
throws Exception
{
Expand Down
Loading