You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by fg...@apache.org on 2006/01/22 14:30:21 UTC
svn commit: r371287 - in /maven/plugins/trunk/maven-eclipse-plugin/src:
main/java/org/apache/maven/plugin/eclipse/
main/java/org/apache/maven/plugin/eclipse/writers/
main/resources/org/apache/maven/plugin/eclipse/ site/ site/apt/
Author: fgiust
Date: Sun Jan 22 05:30:12 2006
New Revision: 371287
URL: http://svn.apache.org/viewcvs?rev=371287&view=rev
Log:
MECLIPSE-25 Allow disabling of WTP stuff using wtpversion=none
added documentation (general documentation from the eclipse mini guide)
Added:
maven/plugins/trunk/maven-eclipse-plugin/src/site/
maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/
maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/overview.apt (with props)
maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/reactor.apt (with props)
maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/wtp.apt (with props)
maven/plugins/trunk/maven-eclipse-plugin/src/site/site.xml (with props)
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseSettingsWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=371287&r1=371286&r2=371287&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java Sun Jan 22 05:30:12 2006
@@ -231,9 +231,9 @@
/**
* The version of WTP for which configuration files will be generated.
- * The default value is "R7", supported versions are "R7" and "1.0"
+ * The default value is "none" (don't generate WTP configuration), supported versions are "R7" and "1.0"
*
- * @parameter expression="${wtpversion}" default-value="R7"
+ * @parameter expression="${wtpversion}" default-value="none"
*/
private String wtpversion;
@@ -243,6 +243,16 @@
private List missingSourceArtifacts = new ArrayList();
/**
+ * Not a plugin parameter. Are we working with wtp r7?
+ */
+ private boolean wtpR7;
+
+ /**
+ * Not a plugin parameter. Are we working with wtp 1.0?
+ */
+ private boolean wtp10;
+
+ /**
* @see org.apache.maven.plugin.Mojo#execute()
*/
public void execute()
@@ -256,6 +266,19 @@
wtpversion, StringUtils.join( WTP_SUPPORTED_VERSIONS, " " ) } ) ); //$NON-NLS-1$
}
+ if ( "R7".equalsIgnoreCase( wtpversion ) ) //$NON-NLS-1$
+ {
+ wtpR7 = true;
+ }
+ else if ( "1.0".equalsIgnoreCase( wtpversion ) ) //$NON-NLS-1$
+ {
+ wtp10 = true;
+ }
+ if ( !"none".equalsIgnoreCase( wtpversion ) )
+ {
+ getLog().info( Messages.getString( "EclipsePlugin.wtpversion", wtpversion ) );
+ }
+
if ( executedProject == null )
{
// backwards compat with alpha-2 only
@@ -350,14 +373,14 @@
downloadSourceArtifacts( artifacts, reactorArtifacts );
- if ( "R7".equalsIgnoreCase( wtpversion ) ) //$NON-NLS-1$
+ if ( wtpR7 )
{
new EclipseWtpmodulesWriter( getLog(), eclipseProjectDir, project, artifacts ).write( reactorArtifacts,
sourceDirs,
localRepository,
buildOutputDirectory );
}
- else if ( wtpversion != null && wtpversion.startsWith( "1" ) ) //$NON-NLS-1$
+ else if ( wtp10 )
{
new EclipseWtpFacetsWriter( getLog(), eclipseProjectDir, project, artifacts ).write( reactorArtifacts,
sourceDirs,
@@ -412,14 +435,18 @@
{
projectnatures = new ArrayList();
- if ( !"R7".equalsIgnoreCase( wtpversion ) ) //$NON-NLS-1$
+ if ( wtp10 )
{
projectnatures.add( NATURE_WST_FACET_CORE_NATURE ); // WTP 1.0 nature
}
projectnatures.add( NATURE_JDT_CORE_JAVA );
- projectnatures.add( NATURE_WST_MODULE_CORE_NATURE ); // WTP 0.7/1.0 nature
- projectnatures.add( NATURE_JEM_WORKBENCH_JAVA_EMF ); // WTP 0.7/1.0 nature
+
+ if ( wtpR7 || wtp10 )
+ {
+ projectnatures.add( NATURE_WST_MODULE_CORE_NATURE ); // WTP 0.7/1.0 nature
+ projectnatures.add( NATURE_JEM_WORKBENCH_JAVA_EMF ); // WTP 0.7/1.0 nature
+ }
}
@@ -433,16 +460,19 @@
{
buildcommands = new ArrayList();
- if ( "R7".equalsIgnoreCase( wtpversion ) ) //$NON-NLS-1$
+ if ( wtpR7 )
{
buildcommands.add( BUILDER_WST_COMPONENT_STRUCTURAL ); // WTP 0.7 builder
}
buildcommands.add( BUILDER_JDT_CORE_JAVA );
- buildcommands.add( BUILDER_WST_VALIDATION ); // WTP 0.7/1.0 builder
+ if ( wtpR7 || wtp10 )
+ {
+ buildcommands.add( BUILDER_WST_VALIDATION ); // WTP 0.7/1.0 builder
+ }
- if ( "R7".equalsIgnoreCase( wtpversion ) ) //$NON-NLS-1$
+ if ( wtpR7 )
{
buildcommands.add( BUILDER_WST_COMPONENT_STRUCTURAL_DEPENDENCY_RESOLVER ); // WTP 0.7 builder
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseSettingsWriter.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseSettingsWriter.java?rev=371287&r1=371286&r2=371287&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseSettingsWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseSettingsWriter.java Sun Jan 22 05:30:12 2006
@@ -51,8 +51,6 @@
private static final String JDK_1_2_SOURCES = "1.2"; //$NON-NLS-1$
- private static final String JDK_1_3_SOURCES = "1.3"; //$NON-NLS-1$
-
private static final String FILE_ECLIPSE_JDT_CORE_PREFS = "org.eclipse.jdt.core.prefs"; //$NON-NLS-1$
private static final String PROP_ECLIPSE_PREFERENCES_VERSION = "eclipse.preferences.version"; //$NON-NLS-1$
@@ -82,7 +80,7 @@
String target = EclipseUtils.getPluginSetting( getProject(), ARTIFACT_MAVEN_COMPILER_PLUGIN, PROPERTY_TARGET,
null );
- if ( source != null && !JDK_1_3_SOURCES.equals( source ) )
+ if ( source != null )
{
coreSettings.put( PROP_JDT_CORE_COMPILER_SOURCE, source );
coreSettings.put( PROP_JDT_CORE_COMPILER_COMPLIANCE, source );
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties?rev=371287&r1=371286&r2=371287&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties Sun Jan 22 05:30:12 2006
@@ -17,6 +17,7 @@
EclipsePlugin.artifactpathisnull=The artifact path was null. Artifact id: {0}
EclipsePlugin.artifactissystemscoped=The artifact has scope ''system''. Artifact id: {0}. System path: {1}
EclipsePlugin.unsupportedwtp=Unsupported WTP version: {0}. This plugin currently supports only the following versions: {1}.
+EclipsePlugin.wtpversion=Adding support for WTP version {0}.
EclipsePlugin.missingjrecontainer=You did specify a list of classpath containers without the base org.eclipse.jdt.launching.JRE_CONTAINER.\n If you specify custom classpath containers you should also add org.eclipse.jdt.launching.JRE_CONTAINER to the list
EclipseSettingsWriter.wrotesettings=Wrote settings to {0}
Added: maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/overview.apt
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/overview.apt?rev=371287&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/overview.apt (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/overview.apt Sun Jan 22 05:30:12 2006
@@ -0,0 +1,74 @@
+ ------
+ Guide to using Eclipse with Maven 2.x
+ ------
+ Bernd Mau, mau@hhla.de
+ ------
+ 28 October 2005
+ ------
+
+Guide to using Eclipse with Maven 2.x
+
+ This mini guide explains howto use Maven 2 in Eclipse IDE.
+
+ * {{{#Maven 2 repository}Maven 2 repository}}
+
+ * {{{#Maven as an external tool}Maven as an external tool}}
+
+ * {{{#Simple Project}Simple Project}}
+
+* {Maven 2 repository}
+
+ Eclipse needs to know the path to the local maven
+repository. Therefore the classpath variable <M2_REPO> has to be
+set. Execute the following command:
+
++----+
+
+mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo
+
++----+
+
+ You can also define a new classpath variable inside eclipse: From the
+menu bar, select Window > Preferences. Select the Java > Build Path >
+Classpath Variables page.
+
+* {Maven as an external tool}
+
+ You might want to execute some maven goals from inside eclipse. This
+is possible by configuring an external launcher.
+
+ It is best practice to prepare eclipse by adding a variable, which points to your local
+maven excutable (mvn.bat/mvn).
+
+ From the menu bar, select Window > Preferences.
+ Select the Run/Debug > String Substitution. Add a new variable e.g. <maven_exec>.
+
+ When you set up a new external launcher (from the menu bar, select Run > External Tools. Select Program) you
+can refer to <maven_exec> in the location field.
+
+ Furhtermore refer to <project_loc> as the working directory and specify the maven goals of
+your choice as arguments, e.g. <eclipse:eclipse>.
+
+ For further information please refer to the eclipse help.
+
+
+* {Simple Project}
+
+ If you have a simple java project which is made up of only one
+module, using eclipse is very simple. To generate the eclipse project
+files from your POM you execute the following command:
+
++----+
+
+mvn eclipse:eclipse
+
++----+
+
+ If you have created or checked out the project with eclipse, you only
+have to refresh the project in your workspace. Otherwise you have to
+import the project into your eclipse workspace (From the menu bar,
+select File >Import >Existing Projects into Workspace). In the
+latter case the project (directory) should not be located in your
+workspace, because eclipse might come into trouble, especially if you
+want to use eclipse as the scm client.
+
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/overview.apt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/overview.apt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/reactor.apt
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/reactor.apt?rev=371287&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/reactor.apt (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/reactor.apt Sun Jan 22 05:30:12 2006
@@ -0,0 +1,158 @@
+ ------
+ Multiple Module Project with eclipse
+ ------
+ Bernd Mau, mau@hhla.de
+ Fabrizio Giustina
+ ------
+ 22-01-2006
+ ------
+
+Multiple Module Projects
+
+* Project layout
+
+ Due to the workspace idea many eclipse users are used to a flat
+layout and therefore want to keep this structure.
+ The following sample shows how to handle maven multiple module projects with eclipse
+both with the standard maven hierachical project layout than with a flat eclipse-like layout.
+
+
+** Hierachical project layout
+
+ Supposing eclipse is your favorite SCM client, this step by step
+example shows how to set up a new mutiple module project.
+
+ [[1]] Set up a new eclipse workspace called <step-by-step> and add
+the <M2_REPO> classpath variable.
+
+ [[1]] Open the command line shell and change to the newly created workspace directory.
+
+ [[1]] From the command line change to newly created <step-by-step>
+workspace and create a new maven project using the archetype plugin.
+
++----+
+mvn archetype:create -DgroupId=guide.ide.eclipse -DartifactId=guide-ide-eclipse
++----+
+
+ [[1]] Create a new simple project <guide-ide-eclipse> inside the
+<step-by-step> workspace with eclipse (From the menu bar, select
+File >New >Project. Select Simple >Project). Eclipse will
+create a simple <.project>-file for your <guide-ide-eclipse>-project
+and you should be able to see the <pom.xml>-file.
+
+ [[1]] Delete the <src>-folder and open the <pom.xml>-file to change
+the packaging of your parent project to <pom>
+
++----+
+ <packaging>pom</packaging>
++----+
+
+ [[1]] From the command line change to the <guide-ide-eclipse> project
+directory and create some modules.
+
++----+
+cd guide-ide-eclipse
+mvn archetype:create -DgroupId=guide.ide.eclipse -DartifactId=guide-ide-eclipse-site
+mvn archetype:create -DgroupId=guide.ide.eclipse.core -DartifactId=guide-ide-eclipse-core
+mvn archetype:create -DgroupId=guide.ide.eclipse.module1 -DartifactId=guide-ide-eclipse-module1
++----+
+
+ [[1]] Add the newly created modules to your parent pom.
+
++----+
+ <modules>
+ <module>guide-ide-eclipse-site</module>
+ <module>guide-ide-eclipse-core</module>
+ <module>guide-ide-eclipse-module1</module>
+ </modules>
++----+
+
+ [[1]] Add the parent to the POMs of the new modules:
+
++----+
+ <parent>
+ <groupId>guide.ide.eclipse</groupId>
+ <artifactId>guide-ide-eclipse</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
++----+
+
+ [[1]] Add dependency from <module1> to the <core>-module:
+
++----+
+ <dependency>
+ <groupId>guide.ide.eclipse.core</groupId>
+ <artifactId>guide-ide-eclipse-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
++----+
+
+ [[1]] Install the project in your local repository and generate the eclipse files:
+
++----+
+mvn install
+mvn eclipse:eclipse
++----+
+
+ [[1]] Check in your project using the eclipse team support (select
+from the context menu Team >Share Project). <Note:> Don not check
+in the generated eclipse files. If you use CVS you should have a
+<.cvsignore>-file with the following entries for each module:
+
++----+
+target
+.classpath
+.project
+.wtpmodules
++----+
+
+ Even the parent project should have this <.cvsignore>-file. Eclipse
+will automatically generate a new simple <.project>-file when you
+check out the project from the repository.
+
+ []
+
+ From now on you have different options to proceed. If you are working
+on all modules simultanously and you rather have eclipse project
+dependencies than binary dependencies, you should set up a new workspace
+and import all projects form <step-by-step/guide-ide-eclipse>. Note,
+you have to delete the <.project>-file of your parent project
+before. The result is equals to checking out the whole project from
+the command line, running <mvn eclipse:eclipse> and finally importing
+the projects into your eclipse workspace. In both cases you will be
+able to synchronize your changes using eclipse.
+
+ In case of large projects whith many people it can be quite tedious
+to check out all modules and keep them up to date. Especially if you
+are only interested in one or two modules. In this case using binary
+dependencies is much more comfortable. Just check out the modules you
+want to work on with eclipse and run <mvn eclipse:eclipse> for each
+module (see also {{{#Maven as an external tool}Maven as an external
+tool}}). Of course all referenced artifacts have to be available from
+your maven repository.
+
+
+** {Flat Project Layout}
+
+ It is possible to move the parent POM in its own directory on the
+same level with the referenced modules.
+
+ Using a Flat Project Layout you can checkout and edit the parent POM without
+checking out the whole project.
+
+ [[1]] Create a new directory under <guide-ide-eclipse> called
+<guide-ide-eclipse-project> and move the parent POM to it.
+
+ [[1]] Change the module references in the parent POM to:
+
++----+
+ <modules>
+ <module>../guide-ide-eclipse-site</module>
+ <module>../guide-ide-eclipse-core</module>
+ <module>../guide-ide-eclipse-module1</module>
+ </modules>
++----+
+ []
+
+ <<Issue:>> The release plugin does not support the flat structure
+({{{http://jira.codehaus.org/browse/MRELEASE-6}MRELEASE-6}})
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/reactor.apt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/reactor.apt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/wtp.apt
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/wtp.apt?rev=371287&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/wtp.apt (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/wtp.apt Sun Jan 22 05:30:12 2006
@@ -0,0 +1,53 @@
+ ------------------
+ WTP support
+ ------------------
+ Fabrizio Giustina
+ ------------------
+ 22-01-2006
+ ------------------
+
+WTP support
+
+ The eclipse plugin supports creating configurations for eclipse WTP (Web Tools Project).
+ Projects with a WAR packaging are setup as WTP dynamic web projects and runtime dependencies are configured to be used
+ when running them using eclipse internal servers.
+
+
+* WTP versions
+
+ In order to create a configuration for WTP you <always> need to specify the version of WTP you are using.
+
+ The plugin actually supports WTP R7 and 1.0. Note that R7/1.0 configuration files are totally different, so be sure to
+ check the version you are using.
+
+ In order to generate WTP configuration files simply run:
+
++-----------------------------------------------------+
+mvn -Dwtpversion=R7 eclipse:eclipse
++-----------------------------------------------------+
+
+ Where wtpversion can be <<<R7>>>, <<<1.0>>> or <<<none>>> (default)
+
+ <Note that in the 2.0 version of the plugin the default was R7 and WTP configuration was always generated. Now that
+ different incompatible versions are out the default is to not to generate WTP configuration if the user doesn't specify
+ the desired version>
+
+
+
+* WTP 1.0 warning
+
+ Unfortunately WTP 1.0 has been shipped bug which prevents external dependencies from work.
+
+ <<This means that only project-dependencies (in a multi-module build) will work, but any other dependency in the POM
+ will be ignored when running the web application inside eclipse>>
+
+ Apart from this, WTP 1.0 also has a grave performance regression which makes internal server pretty unusable, so we suggest
+ to stay with R7 till WTP 1.0.1 will be out (the external dependency bug is scheduled for such release).
+
+ As a workaround, the current 2.1-SNAPSHOT plugin supports copying external dependencies to src/main/webapp/WEB-INF/lib while
+ creating WTP 1.0 configuration files, but this is not an optimal solution. You can grab it from svn if you really need
+ to work with WTP 1.0 and can't wait for WTP 1.0.1 to be released.
+
+
+
+
\ No newline at end of file
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/wtp.apt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/wtp.apt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-eclipse-plugin/src/site/site.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/site/site.xml?rev=371287&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/site/site.xml (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/site/site.xml Sun Jan 22 05:30:12 2006
@@ -0,0 +1,22 @@
+<project name="Maven Eclipse plugin">
+ <bannerLeft>
+ <name>Maven Eclipse plugin</name>
+ <src>http://maven.apache.org/images/apache-maven-project.png</src>
+ <href>http://maven.apache.org/</href>
+ </bannerLeft>
+ <bannerRight>
+ <src>http://maven.apache.org/images/maven-small.gif</src>
+ </bannerRight>
+ <body>
+ <links>
+ <item name="Maven 2" href="http://maven.apache.org/"/>
+ </links>
+
+ <menu name="Overview">
+ <item name="Maven 2 and Eclipse" href="overview.html"/>
+ <item name="Multiple Module Projects" href="reactor.html"/>
+ <item name="WTP" href="wtp.html"/>
+ </menu>
+ ${reports}
+ </body>
+</project>
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/site/site.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/site/site.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision