Update of /var/cvs/applications/app-base/plugin/src/main/java/org/mmbase/mojo In directory james.mmbase.org:/tmp/cvs-serv14838/src/main/java/org/mmbase/mojo
Modified Files: DeployJar.java InstallJar.java Log Message: simplified, the jar can better not have it's own pom, it was created by an existing pom, used for the war See also: http://cvs.mmbase.org/viewcvs/applications/app-base/plugin/src/main/java/org/mmbase/mojo Index: DeployJar.java =================================================================== RCS file: /var/cvs/applications/app-base/plugin/src/main/java/org/mmbase/mojo/DeployJar.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- DeployJar.java 17 Feb 2009 17:03:39 -0000 1.4 +++ DeployJar.java 17 Feb 2009 19:44:13 -0000 1.5 @@ -2,15 +2,11 @@ import org.apache.maven.plugin.*; import org.apache.maven.project.*; -import org.apache.maven.model.*; import org.apache.maven.artifact.deployer.ArtifactDeployer; import org.apache.maven.artifact.deployer.ArtifactDeploymentException; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.project.artifact.ProjectArtifactMetadata; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; -import org.apache.maven.artifact.repository.DefaultArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; @@ -22,13 +18,13 @@ import java.lang.reflect.*; /** - * Would have likes to extends from FileInstallMojo. But that is imposible. Many private members. It - * makes me quit tired, but well. This class therefore much more complicated than what would be sane - * for the small thing that it tries to do. + * This goal is associated with the deploy phase of a 'war' package, to deploy the jar as well. * * @phase package * @goal deploy-jar * @requiresProject + * @author Michiel Meeuwissen + * @version $Id: DeployJar.java,v 1.5 2009/02/17 19:44:13 michiel Exp $ */ public class DeployJar extends AbstractMojo { @@ -118,39 +114,8 @@ String groupId = project.getGroupId(); - Artifact artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, packaging, null); - - - ArtifactMetadata metadata = null; - Artifact pomArtifact = null; - FileWriter fw = null; - try { - File tempFile = File.createTempFile( "mvninstall", ".pom" ); - tempFile.deleteOnExit(); - - Model model = new Model(); - model.setModelVersion("4.0.0"); - model.setGroupId( groupId); - model.setArtifactId( artifactId); - model.setVersion(version); - model.setPackaging(packaging); - model.setDescription("POM was created from mmbase:deploy-jar" ); - fw = new FileWriter(tempFile); - new MavenXpp3Writer().write( fw, model); - metadata = new ProjectArtifactMetadata( artifact, tempFile); - artifact.addMetadata(metadata); - } catch (IOException e ) { - throw new MojoExecutionException( "Error writing temporary pom file: " + e.getMessage(), e ); - } finally { - try { - fw.close(); - } catch (IOException ioe) { - } - } - + Artifact artifact = artifactFactory.createArtifactWithClassifier(groupId, artifactId, version, packaging, null); File file = new File (dir + "/" + artifactId + "-" + version + "/WEB-INF/lib/" + artifactId + "-" + version + ".jar"); - - ArtifactRepositoryLayout layout = ( ArtifactRepositoryLayout ) repositoryLayouts.get( repositoryLayout ); Index: InstallJar.java =================================================================== RCS file: /var/cvs/applications/app-base/plugin/src/main/java/org/mmbase/mojo/InstallJar.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- InstallJar.java 17 Feb 2009 17:03:39 -0000 1.4 +++ InstallJar.java 17 Feb 2009 19:44:13 -0000 1.5 @@ -2,17 +2,13 @@ import org.apache.maven.plugin.*; import org.apache.maven.project.*; -import org.apache.maven.model.*; import org.apache.maven.artifact.installer.ArtifactInstaller; import org.apache.maven.artifact.installer.ArtifactInstallationException; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.project.artifact.ProjectArtifactMetadata; -import org.apache.maven.artifact.repository.DefaultArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository; - import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.model.io.xpp3.MavenXpp3Writer; @@ -22,13 +18,13 @@ import java.lang.reflect.*; /** - * Would have likes to extends from FileInstallMojo. But that is imposible. Many private members. It - * makes me quit tired, but well. This class therefore much more complicated than what would be sane - * for the small thing that it tries to do. + * This goal is associated with the install phase of a 'war' package, to install the jar as well. * * @phase install * @goal install-jar * @requiresProject + * @author Michiel Meeuwissen + * @version $Id: InstallJar.java,v 1.5 2009/02/17 19:44:13 michiel Exp $ */ public class InstallJar extends AbstractMojo { @@ -82,35 +78,6 @@ Artifact artifact = artifactFactory.createArtifactWithClassifier(groupId, artifactId, version, packaging, null); - - - ArtifactMetadata metadata = null; - Artifact pomArtifact = null; - FileWriter fw = null; - try { - File tempFile = File.createTempFile( "mvninstall", ".pom" ); - tempFile.deleteOnExit(); - - Model model = new Model(); - model.setModelVersion( "4.0.0"); - model.setGroupId( groupId); - model.setArtifactId( artifactId); - model.setVersion(version); - model.setPackaging(packaging); - model.setDescription("POM was created from mmbase:install-jar"); - fw = new FileWriter(tempFile); - new MavenXpp3Writer().write(fw, model); - metadata = new ProjectArtifactMetadata( artifact, tempFile); - artifact.addMetadata(metadata); - } catch (IOException e ) { - throw new MojoExecutionException( "Error writing temporary pom file: " + e.getMessage(), e ); - } finally { - try { - fw.close(); - } catch (IOException ioe) { - } - } - File file = new File (dir + "/" + artifactId + "-" + version + "/WEB-INF/lib/" + artifactId + "-" + version + ".jar"); try { installer.install(file, artifact, localRepository); _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs