jvanzyl 2004/05/20 10:04:09 Modified: maven-plugins/maven-idea-plugin project.xml maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea IdeaPlugin.java IdeaWriter.java Log: turn into a maven plugin and add @tags for descriptor generation. Revision Changes Path 1.4 +0 -16 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- project.xml 5 May 2004 20:51:03 -0000 1.3 +++ project.xml 20 May 2004 17:04:09 -0000 1.4 @@ -10,13 +10,7 @@ <artifactId>maven-idea-plugin</artifactId> <name>Maven</name> <version>1.0-SNAPSHOT</version> - <inceptionYear>2001</inceptionYear> <package>org.apache.maven</package> - <repository> - <connection>scm:cvs:pserver:[EMAIL PROTECTED]:/home/cvspublic:maven-components/maven-plugins/maven-scm-plugin</connection> - <developerConnection>scm:cvs:ext:[EMAIL PROTECTED]:/home/cvs:maven-components/maven-plugins/maven-scm-plugin</developerConnection> - <url>http://cvs.apache.org/viewcvs.cgi/maven/</url> - </repository> <dependencies> <dependency> <groupId>maven</groupId> @@ -31,16 +25,6 @@ <dependency> <groupId>maven</groupId> <artifactId>maven-project</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>plexus</groupId> - <artifactId>plexus</artifactId> - <version>0.14-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>maven</groupId> - <artifactId>maven-xdoc-plugin</artifactId> <version>2.0-SNAPSHOT</version> </dependency> </dependencies> 1.5 +6 -4 maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaPlugin.java Index: IdeaPlugin.java =================================================================== RCS file: /home/cvs/maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaPlugin.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- IdeaPlugin.java 9 May 2004 05:05:13 -0000 1.4 +++ IdeaPlugin.java 20 May 2004 17:04:09 -0000 1.5 @@ -6,13 +6,15 @@ import org.apache.maven.plugin.PluginExecutionResponse; /** - * @plugin.id idea - * @plugin.description A maven2 plugin which integrates the use of Maven2 with IntelliJ's IDEA - * @plugin.instantiation singleton - * @plugin.mode integrated + * @maven.plugin.id idea + * @maven.plugin.description A maven2 plugin which integrates the use of Maven2 with IntelliJ's IDEA + * + * @parameter project MavenProject true validator description * * @goal.name idea + * @goal.idea.description Goal for generating IDEA files from a POM * @goal.idea.parameter project #project + * */ public class IdeaPlugin extends AbstractPlugin 1.2 +16 -4 maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaWriter.java Index: IdeaWriter.java =================================================================== RCS file: /home/cvs/maven-components/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaWriter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- IdeaWriter.java 9 May 2004 02:26:57 -0000 1.1 +++ IdeaWriter.java 20 May 2004 17:04:09 -0000 1.2 @@ -2,8 +2,6 @@ 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.codehaus.plexus.util.InterpolationFilterReader; import java.io.File; @@ -15,6 +13,9 @@ import java.util.Map; import java.util.List; +import com.thoughtworks.xstream.xml.XMLWriter; +import com.thoughtworks.xstream.xml.text.PrettyPrintXMLWriter; + public class IdeaWriter { public void write( MavenProject project ) @@ -71,7 +72,7 @@ { FileWriter w = new FileWriter( new File( basedir, project.getArtifactId() + ".iml" ) ); - XMLWriter writer = new DefaultXMLWriter( w ); + XMLWriter writer = new PrettyPrintXMLWriter( w ); writer.startElement( "module" ); @@ -168,6 +169,11 @@ writeModuleLibraryEntry( writer, ( (MavenArtifact) artifacts.get( i ) ) ); } + // For testing it can't hurt to have junit listed + + writeModuleLibraryEntry( writer, + new File( project.getProperty( "maven.repo.local" ), "junit/jars/junit-3.8.1.jar" ).getPath() ); + // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- @@ -192,6 +198,12 @@ protected void writeModuleLibraryEntry( XMLWriter writer, MavenArtifact artifact ) throws Exception { + writeModuleLibraryEntry( writer, artifact.getPath() ); + } + + protected void writeModuleLibraryEntry( XMLWriter writer, String libraryPath ) + throws Exception + { writer.startElement( "orderEntry" ); writer.addAttribute( "type", "module-library" ); @@ -202,7 +214,7 @@ writer.startElement( "root" ); - writer.addAttribute( "url", "jar://" + artifact.getPath() + "!/" ); + writer.addAttribute( "url", "jar://" + libraryPath + "!/" ); writer.endElement();
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]