cvs commit: maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin IdeaPlugin.java
jvanzyl 2004/05/05 15:56:58 Modified:maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin IdeaPlugin.java Log: o cleaning up before writing out the project file using the xml writer in order to create a reactor aware mode that can write out multiple IDEA modules for an IDEA project where: IDEA module == Maven project Revision ChangesPath 1.4 +32 -28 maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/IdeaPlugin.java Index: IdeaPlugin.java === RCS file: /home/cvs/maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/IdeaPlugin.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- IdeaPlugin.java 5 May 2004 20:51:03 - 1.3 +++ IdeaPlugin.java 5 May 2004 22:56:58 - 1.4 @@ -1,9 +1,9 @@ package org.apache.maven.plugin; +import org.apache.maven.artifact.MavenArtifact; import org.apache.maven.project.MavenProject; -import org.apache.maven.xdoc.render.XMLWriter; import org.apache.maven.xdoc.render.DefaultXMLWriter; -import org.apache.maven.artifact.MavenArtifact; +import org.apache.maven.xdoc.render.XMLWriter; import org.codehaus.plexus.util.InterpolationFilterReader; import java.io.File; @@ -13,7 +13,6 @@ import java.io.Writer; import java.util.HashMap; import java.util.Map; -import java.util.Iterator; public class IdeaPlugin extends AbstractPlugin @@ -29,42 +28,47 @@ map.put( "project.artifactId", project.getArtifactId() ); +writeIdeaModule( basedir, project, map ); + +writeIdeaWorkSpace( basedir, project, map ); + +writeIdeaProject( basedir, project, map ); +} + +// -- +// IDEA project +// -- + +private void writeIdeaProject( File basedir, MavenProject project, Map map ) +throws Exception +{ copy( IdeaPlugin.class.getResourceAsStream( "/plugin-resources/default/idea.ipr" ), new FileWriter( new File( basedir, project.getArtifactId() + ".ipr" ) ), map ); +} + +// -- +// IDEA workspace +// -- +private void writeIdeaWorkSpace( File basedir, MavenProject project, Map map ) +throws Exception +{ copy( IdeaPlugin.class.getResourceAsStream( "/plugin-resources/default/idea.iws" ), new FileWriter( new File( basedir, project.getArtifactId() + ".iws" ) ), map ); +} +// -- +// IDEA module +// -- + +private void writeIdeaModule( File basedir, MavenProject project, Map map ) +throws Exception +{ FileWriter w = new FileWriter( new File( basedir, project.getArtifactId() + ".iml" ) ); XMLWriter writer = new DefaultXMLWriter( w ); - -/* - - - - - - - - - - - - - - - - - - - - - - -*/ writer.startElement( "module" ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin IdeaPlugin.java
jvanzyl 2004/05/05 13:51:03 Modified:maven-plugins/maven-idea-plugin project.xml maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin IdeaPlugin.java Log: o use the java.version system property. i'm sure we could configure this in other ways i.e. maybe accessing the list of available jvms from IDEA itself but this will do for now. Revision ChangesPath 1.3 +5 -0 maven-components/maven-plugins/maven-idea-plugin/project.xml Index: project.xml === RCS file: /home/cvs/maven-components/maven-plugins/maven-idea-plugin/project.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- project.xml 5 May 2004 20:33:30 - 1.2 +++ project.xml 5 May 2004 20:51:03 - 1.3 @@ -25,6 +25,11 @@ maven + maven-model + 2.0-SNAPSHOT + + + maven maven-project 2.0-SNAPSHOT 1.3 +3 -1 maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/IdeaPlugin.java Index: IdeaPlugin.java === RCS file: /home/cvs/maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/IdeaPlugin.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IdeaPlugin.java 5 May 2004 20:45:08 - 1.2 +++ IdeaPlugin.java 5 May 2004 20:51:03 - 1.3 @@ -132,7 +132,9 @@ writer.addAttribute( "type", "jdk" ); -writer.addAttribute( "jdkName", "java version "1.4.2"" ); +String javaVersion = System.getProperty( "java.version" ); + +writer.addAttribute( "jdkName", "java version " " + javaVersion + """ ); writer.endElement(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin IdeaPlugin.java
jvanzyl 2004/05/05 13:45:08 Modified:maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin IdeaPlugin.java Log: o take the source directories from the model. we want to use relative paths so reach into the model for the unexpanded paths. Revision ChangesPath 1.2 +2 -2 maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/IdeaPlugin.java Index: IdeaPlugin.java === RCS file: /home/cvs/maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/IdeaPlugin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- IdeaPlugin.java 5 May 2004 16:52:38 - 1.1 +++ IdeaPlugin.java 5 May 2004 20:45:08 - 1.2 @@ -100,7 +100,7 @@ writer.startElement( "sourceFolder" ); -writer.addAttribute( "url", "file://$MODULE_DIR$/src/main/java" ); +writer.addAttribute( "url", "file://$MODULE_DIR$/" + project.getModel().getBuild().getSourceDirectory() ); writer.addAttribute( "isTestSource", "false" ); @@ -112,7 +112,7 @@ writer.startElement( "sourceFolder" ); -writer.addAttribute( "url", "file://$MODULE_DIR$/src/test/java" ); +writer.addAttribute( "url", "file://$MODULE_DIR$/" + project.getModel().getBuild().getUnitTestSourceDirectory() ); writer.addAttribute( "isTestSource", "true" ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]