mirror of https://github.com/apache/maven.git
write out the generated POM to avoid a waster URL connection next time
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@226541 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
47744229e8
commit
d978e51dc6
|
@ -39,6 +39,7 @@ import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.model.ReportPlugin;
|
import org.apache.maven.model.ReportPlugin;
|
||||||
import org.apache.maven.model.Repository;
|
import org.apache.maven.model.Repository;
|
||||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||||
|
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationCalculator;
|
import org.apache.maven.profiles.activation.ProfileActivationCalculator;
|
||||||
import org.apache.maven.project.inheritance.ModelInheritanceAssembler;
|
import org.apache.maven.project.inheritance.ModelInheritanceAssembler;
|
||||||
import org.apache.maven.project.injection.ModelDefaultsInjector;
|
import org.apache.maven.project.injection.ModelDefaultsInjector;
|
||||||
|
@ -62,6 +63,7 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
@ -352,7 +354,28 @@ public class DefaultMavenProjectBuilder
|
||||||
// TODO: not correct in some instances
|
// TODO: not correct in some instances
|
||||||
model.setPackaging( artifact.getType() );
|
model.setPackaging( artifact.getType() );
|
||||||
|
|
||||||
// TODO: save to disk with a "generated" status
|
model.setDistributionManagement( new DistributionManagement() );
|
||||||
|
model.getDistributionManagement().setStatus( ArtifactStatus.GENERATED.toString() );
|
||||||
|
|
||||||
|
File file = artifact.getFile();
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
|
||||||
|
FileWriter writer = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
writer = new FileWriter( file );
|
||||||
|
|
||||||
|
MavenXpp3Writer w = new MavenXpp3Writer();
|
||||||
|
w.write( writer, model );
|
||||||
|
}
|
||||||
|
catch ( IOException ioe )
|
||||||
|
{
|
||||||
|
getLogger().warn( "Attempted to write out a temporary generated POM, but failed", ioe );
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IOUtil.close( writer );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue