Added "idea:multiproject" goal. (IDEA 4 only).

It creates the idea module files (.iml) via reactor and main project which aggregates
this modules. Each module has it's own classpath, src and test, traget dir setting etc.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114582 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
michal 2004-01-10 14:32:59 +00:00
parent a526454aa3
commit 9f73daab0e
7 changed files with 314 additions and 31 deletions

View File

@ -1,3 +1,4 @@
target target
velocity.log velocity.log
maven.log maven.log
*.iml

View File

@ -1,39 +1,114 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:util="jelly:util"> <project xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:util="jelly:util"
xmlns:maven="jelly:maven">
<!--==================================================================--> <!--==================================================================-->
<!-- Generate IntelliJ IDEA project, workspace and model files --> <!-- Generate IntelliJ IDEA project, workspace and model files -->
<!--==================================================================--> <!--==================================================================-->
<goal name="idea" <goal name="idea"
description="Generate IDEA project files" description="Generate IDEA project files"
prereqs="idea:generate-project"/> prereqs="idea:idea"/>
<goal name="idea:generate-project" <goal name="idea:init">
description="Generate IDEA .ipr, .iml and .iws project files"> <j:set var="template.dir" value="${plugin.resources}/templates/v${maven.idea.project.version}"/>
</goal>
<j:set var="template.dir" value="${plugin.resources}/templates/v${maven.idea.project.version}" />
<ant:echo>Creating ${basedir}/${pom.artifactId}.ipr ...</ant:echo> <goal name="idea:project"
description="Generate IDEA .ipr project files"
prereqs="idea:init">
<ant:echo>Creating ${basedir}/${pom.artifactId}.ipr ...</ant:echo>
<j:file name="${basedir}/${pom.artifactId}.ipr" prettyPrint="true" xmlns="dummy"> <j:file name="${basedir}/${pom.artifactId}.ipr" prettyPrint="true" xmlns="dummy">
<j:import file="${template.dir}/project.jelly" inherit="true"/> <j:import file="${template.dir}/project.jelly" inherit="true"/>
</j:file> </j:file>
<ant:echo>Creating ${basedir}/${pom.artifactId}.iws ...</ant:echo> </goal>
<j:file name="${basedir}/${pom.artifactId}.iws" prettyPrint="true" xmlns="dummy">
<j:import file="${template.dir}/workspace.jelly" inherit="true"/>
</j:file>
<util:available file="${template.dir}/module.jelly"> <goal name="idea:workspace"
<ant:echo>Creating ${basedir}/${pom.artifactId}.iml ...</ant:echo> description="Generate IDEA .iws project files"
prereqs="idea:init">
<ant:echo>Creating ${basedir}/${pom.artifactId}.iws ...</ant:echo>
<j:file name="${basedir}/${pom.artifactId}.iml" prettyPrint="true" xmlns="dummy"> <j:file name="${basedir}/${pom.artifactId}.iws" prettyPrint="true" xmlns="dummy">
<j:import file="${template.dir}/module.jelly" inherit="true"/> <j:import file="${template.dir}/workspace.jelly" inherit="true"/>
</j:file> </j:file>
</util:available> </goal>
</goal> <!-- -->
<goal name="idea:idea"
description="Generate IDEA .ipr, .iml and .iws project files">
<attainGoal name="idea:project"/>
<attainGoal name="idea:workspace"/>
<attainGoal name="idea:module"/>
</goal>
<goal name="idea:module"
description="Generate IDEA .iml project files"
prereqs="idea:init">
<util:available file="${template.dir}/module.jelly">
<ant:echo>Creating ${basedir}/${pom.artifactId}.iml ...</ant:echo>
<j:file name="${basedir}/${pom.artifactId}.iml" prettyPrint="true" xmlns="dummy">
<j:import file="${template.dir}/module.jelly" inherit="true"/>
</j:file>
</util:available>
</goal>
<!--
-->
<goal name="idea:multiproject" prereqs="idea:init">
<j:set var="ideaVersion" value="${maven.idea.project.version}"/>
<j:if test="${ideaVersion=='3'}">
<ant:echo>WARNING: This goal should be used only with IDEA 4.</ant:echo>
<ant:echo>Property 'maven.idea.project.version' is set to '3'</ant:echo>
<!-- how to exist from goal? -->
</j:if>
<attainGoal name="idea:workspace"/>
<!-- Finding modules -->
<!-- we use plugin's own settings in first order. -->
<!-- if they are not provided we will try use use multiproject settings -->
<j:set var="multiprojectIncludes" value="${maven.idea.project.multiproject.includes}"/>
<j:if test="${multiprojectIncludes == null or multiprojectIncludes.length() eq 0}">
<maven:pluginVar var="multiprojectIncludes" plugin="maven-multiproject-plugin" property="maven.multiproject.includes"/>
</j:if>
<j:set var="multiprojectExcludes" value="${maven.idea.project.multiproject.excludes}"/>
<j:if test="${multiprojectExcludes == null or multiprojectExcludes.length() eq 0}">
<maven:pluginVar var="multiprojectExcludes" plugin="maven-multiproject-plugin" property="maven.multiproject.excludes"/>
</j:if>
<j:set var="multiprojectBasedir" value="${maven.idea.project.multiproject.basedir}"/>
<j:if test="${multiprojectBasedir == null or multiprojectBasedir.length() eq 0}">
<maven:pluginVar var="multiprojectBasedir" plugin="maven-multiproject-plugin" property="maven.multiproject.basedir"/>
</j:if>
<maven:reactor
basedir="${multiprojectBasedir}"
banner="Generating idea module file for:"
includes="${multiprojectIncludes}"
excludes="${multiprojectExcludes}"
postProcessing="true"
goals="idea:module"
ignoreFailures="true"/>
<ant:echo>Creating ${basedir}/${pom.artifactId}.ipr ...</ant:echo>
<j:file name="${basedir}/${pom.artifactId}.ipr" prettyPrint="true" xmlns="dummy">
<j:import file="${template.dir}/multiproject.jelly" inherit="true"/>
</j:file>
</goal>
</project> </project>

View File

@ -5,7 +5,7 @@
<pomVersion>3</pomVersion> <pomVersion>3</pomVersion>
<id>maven-idea-plugin</id> <id>maven-idea-plugin</id>
<name>Maven IDEA Plug-in</name> <name>Maven IDEA Plug-in</name>
<currentVersion>1.2</currentVersion> <currentVersion>1.3-SNAPSHOT</currentVersion>
<shortDescription>IDEA Plugin for Maven</shortDescription> <shortDescription>IDEA Plugin for Maven</shortDescription>
<url>http://maven.apache.org/reference/plugins/idea/</url> <url>http://maven.apache.org/reference/plugins/idea/</url>
<siteDirectory>/www/maven.apache.org/reference/plugins/idea/</siteDirectory> <siteDirectory>/www/maven.apache.org/reference/plugins/idea/</siteDirectory>
@ -42,5 +42,14 @@
<role>Java Developer</role> <role>Java Developer</role>
</roles> </roles>
</developer> </developer>
<developer>
<name>Michal Maczka</name>
<id>michal</id>
<email>michal.maczka@dimatics.com</email>
<organization>Dimatics</organization>
<roles>
<role>Java Developer</role>
</roles>
</developer>
</developers> </developers>
</project> </project>

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<j:whitespace xmlns:j="jelly:core" xmlns="dummy" trim="true">
<project version="4" relativePaths="false">
<component name="ProjectRootManager" version="2" assert-keyword="false"/>
<component name="CodeStyleManager">
<option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="true"/>
<option name="CODE_STYLE_SCHEME" value=""/>
</component>
<component name="ProjectModuleManager">
<modules>
<module filepath="$$PROJECT_DIR$$/${pom.artifactId}.iml"/>
</modules>
</component>
<component name="libraryTable"/>
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac"/>
<option name="CLEAR_OUTPUT_DIRECTORY" value="false"/>
<!-- TODO: exclusions?
<excludeFromCompile>
<file url="file://$$PROJECT_DIR$$/src/webapp/WEB-INF/jsp/index.jspf"/>
</excludeFromCompile>
-->
<resourceExtensions>
<entry name=".+\.(properties|xml|html)"/>
<entry name=".+\.(gif|png|jpeg)"/>
</resourceExtensions>
</component>
<component name="JavacSettings">
<option name="DEBUGGING_INFO" value="true"/>
<option name="GENERATE_NO_WARNINGS" value="false"/>
<option name="DEPRECATION" value="true"/>
<option name="ADDITIONAL_OPTIONS_STRING" value=""/>
<option name="MAXIMUM_HEAP_SIZE" value="128"/>
<option name="USE_GENERICS_COMPILER" value="false"/>
</component>
<component name="JikesSettings">
<option name="DEBUGGING_INFO" value="true"/>
<option name="DEPRECATION" value="true"/>
<option name="GENERATE_NO_WARNINGS" value="false"/>
<option name="GENERATE_MAKE_FILE_DEPENDENCIES" value="false"/>
<option name="DO_FULL_DEPENDENCE_CHECK" value="false"/>
<option name="IS_INCREMENTAL_MODE" value="false"/>
<option name="IS_EMACS_ERRORS_MODE" value="true"/>
<option name="ADDITIONAL_OPTIONS_STRING" value=""/>
<option name="MAXIMUM_HEAP_SIZE" value="128"/>
</component>
<component name="AntConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false"/>
<option name="FILTER_TARGETS" value="false"/>
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY"/>
<option name="OPTION_SCOPE" value="protected"/>
<option name="OPTION_HIERARCHY" value="false"/>
<option name="OPTION_NAVIGATOR" value="false"/>
<option name="OPTION_INDEX" value="false"/>
<option name="OPTION_SEPARATE_INDEX" value="false"/>
<option name="OPTION_USE_1_1" value="false"/>
<option name="OPTION_DOCUMENT_TAG_USE" value="false"/>
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false"/>
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false"/>
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="false"/>
<option name="OPTION_DEPRECATED_LIST" value="false"/>
<option name="OTHER_OPTIONS"/>
<option name="HEAP_SIZE"/>
<option name="OPEN_IN_BROWSER" value="false"/>
</component>
<j:set var="webSourceDir" value="${maven.war.src}"/>
<j:choose>
<j:when test="${empty(webSourceDir)}">
<component name="WebManager">
<OPTION enabled="false"/>
</component>
<component name="WebRootContainer"/>
</j:when>
<j:otherwise>
<component name="WebManager">
<OPTION enabled="true"/>
</component>
<component name="WebRootContainer">
<root url="file://$$PROJECT_DIR$$/${webSourceDir}" name="${pom.artifactId}" validate="false"/>
</component>
</j:otherwise>
</j:choose>
<component name="EjbManager" enabled="false"/>
<component name="JUnitProjectSettings">
<option name="TEST_RUNNER" value="UI"/>
</component>
<component name="EntryPointsManager">
<entry_points/>
</component>
<component name="DataSourceManager"/>
<component name="EjbActionsConfiguration">
<option name="NEW_MESSAGE_BEAN_LAST_PACKAGE" value=""/>
<option name="NEW_ENTITY_BEAN_LAST_PACKAGE" value=""/>
<option name="NEW_SESSION_BEAN_LAST_PACKAGE" value=""/>
</component>
<component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false"/>
<option name="OPEN_IN_BROWSER" value="false"/>
<option name="OUTPUT_DIRECTORY"/>
</component>
<component name="ImportConfiguration">
<option name="VENDOR"/>
<option name="RELEASE_TAG"/>
<option name="LOG_MESSAGE"/>
<option name="CHECKOUT_AFTER_IMPORT" value="true"/>
</component>
<component name="ProjectModuleManager">
<modules>
<j:forEach var="project" items="${reactorProjects}">
<j:set var="file" value="file://${project.file.parentFile.canonicalFile}/${project.artifactId}.iml" />
<module fileurl="${file}" filepath="${file}"/>
</j:forEach>
</modules>
</component>
</project>
</j:whitespace>

18
idea/xdocs/changes.xml Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Changes</title>
<author email="michal.maczka@dimatic.com">Michal Maczka</author>
</properties>
<body>
<release version="1.3" date="in CVS">
<action dev="michal" type="add">
Added idea:multiproject goal. Other goals were decomposed.
</action>
</release>
</body>
</document>

View File

@ -15,9 +15,31 @@
</description> </description>
</goal> </goal>
<goal> <goal>
<name>idea:generate-project</name> <name>idea:project</name>
<description> <description>
Generate IDEA .ipr and .iws project files from the POM Generate IDEA .ipr project files
</description>
</goal>
<goal>
<name>idea:workspace</name>
<description>
Generate IDEA .ipw project files
</description>
</goal>
<goal>
<name>idea:workspace</name>
<description>
Generate IDEA .ipw project files
(IDEA 4 only)
</description>
</goal>
<goal>
<name>idea:multiproject</name>
<description>
Generate IDEA .ipr and .iws project files and appends module which are created via reactor.
(IDEA 4 only).
</description> </description>
</goal> </goal>
</goals> </goals>

View File

@ -5,11 +5,16 @@
<title>IDEA Properties</title> <title>IDEA Properties</title>
<author email="kschrader@karmalab.org">Kurt Schrader</author> <author email="kschrader@karmalab.org">Kurt Schrader</author>
<author email="evenisse@ifrance.com">Emmanuel Venisse</author> <author email="evenisse@ifrance.com">Emmanuel Venisse</author>
<author email="michal.amzcka@dimatics.com">Michal Maczka</author>
</properties> </properties>
<body> <body>
<section name="IDEA Settings"> <section name="Maven IDEA lugin Settings">
<table> <table>
<tr>
<th>Property name</th>
<th>Optional?</th>
<th>Description</th>
</tr>
<tr> <tr>
<td>maven.cvs.client.exe</td> <td>maven.cvs.client.exe</td>
<td>Yes</td> <td>Yes</td>
@ -17,7 +22,40 @@
Specifies the cvs path. Specifies the cvs path.
</td> </td>
</tr> </tr>
</table> <tr>
<td>maven.idea.project.multiproject.includes</td>
<td>Yet</td>
<td>
This is the list of file specifications to be
included when searching for projects to be processed
by the plugin.
<br/>
Default value is ${maven.multiproject.includes}
(see <a href="http://maven.apache.org/reference/plugins/multiproject/properties.html">multiproject</a>)
It means that mutiproject setup is used when no value is provided.
</td>
</tr>
<tr>
<td>maven.idea.project.multiproject.excludes</td>
<td>Yet</td>
<td>
This is the list of file specifications to be excluded
when <b>idea:multiproject</b> goal is executed
<br/>
Default value is ${maven.multiproject.excludes}
</td>
</tr>
<tr>
<td>maven.idea.project.multiproject.basdir</td>
<td>No</td>
<td>
This is the base directory that the plugin will use for <b>idea:multiproject</b> goal is executed
<br/>
Default value is ${maven.multiproject.basdir}
</td>
</tr>
</table>
</section> </section>
</body> </body>
</document> </document>