mirror of https://github.com/apache/maven.git
[MNG-533]. Add pom.properties in generated artifact.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@202010 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a029d766ce
commit
17e3c742ee
|
@ -17,8 +17,10 @@ import util.Os;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.StringReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
@ -30,6 +32,7 @@ import java.util.Date;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class MBoot
|
||||
|
@ -729,6 +732,32 @@ public class MBoot
|
|||
|
||||
String version = reader.getVersion();
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Create pom.properties file
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Properties p = new Properties();
|
||||
|
||||
p.setProperty( "groupId", reader.getGroupId() );
|
||||
|
||||
p.setProperty( "artifactId", reader.getArtifactId() );
|
||||
|
||||
p.setProperty( "version", reader.getVersion() );
|
||||
|
||||
File pomPropertiesDir = new File( new File( classes ),
|
||||
"META-INF/maven/" + reader.getGroupId() + "/" + reader.getArtifactId() );
|
||||
|
||||
pomPropertiesDir.mkdirs();
|
||||
|
||||
File pomPropertiesFile = new File( pomPropertiesDir, "pom.properties" );
|
||||
|
||||
OutputStream os = new FileOutputStream( pomPropertiesFile );
|
||||
|
||||
p.store( os, "Generated by Maven" );
|
||||
|
||||
os.close(); // stream is flushed but not closed by Properties.store()
|
||||
|
||||
//TODO: Add pom.xml
|
||||
jarMojo.execute( new File( classes ), buildDir, artifactId + "-" + version );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue