From c3933eb9ff1504106340a742f761c55806da8f8c Mon Sep 17 00:00:00 2001 From: epugh Date: Fri, 15 Oct 2004 09:45:05 +0000 Subject: [PATCH] MPECLIPSE-49 and 49 for working w/ source directories git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116137 13f79535-47bb-0310-9956-ffa450edef68 --- eclipse/plugin.properties | 1 + .../templates/classpath.jelly | 61 ++++++++++++--- eclipse/src/plugin-test/maven.xml | 22 ++++-- eclipse/src/plugin-test/project.xml | 28 +++++++ eclipse/src/plugin-test/src/main/dir.txt | 1 + eclipse/src/plugin-test/src/test/dir.txt | 1 + eclipse/xdocs/changes.xml | 2 + eclipse/xdocs/goals.xml | 1 + eclipse/xdocs/index.xml | 78 +++++++++++++++++++ eclipse/xdocs/properties.xml | 64 ++------------- 10 files changed, 188 insertions(+), 71 deletions(-) create mode 100644 eclipse/src/plugin-test/src/main/dir.txt create mode 100644 eclipse/src/plugin-test/src/test/dir.txt diff --git a/eclipse/plugin.properties b/eclipse/plugin.properties index 2e1f1bb0..dcc4f1e5 100644 --- a/eclipse/plugin.properties +++ b/eclipse/plugin.properties @@ -25,3 +25,4 @@ # and 'plugins' to generate only the plugins' default goals. maven.eclipse.goals = plugins maven.gen.src=${maven.build.dir}/generated-sources +maven.eclipse.src.extension = zip diff --git a/eclipse/src/plugin-resources/templates/classpath.jelly b/eclipse/src/plugin-resources/templates/classpath.jelly index 62501752..34b839e7 100644 --- a/eclipse/src/plugin-resources/templates/classpath.jelly +++ b/eclipse/src/plugin-resources/templates/classpath.jelly @@ -64,7 +64,10 @@ - + + + + @@ -120,7 +123,17 @@ - + + + + + + + + + + + @@ -133,7 +146,10 @@ - + + + + @@ -152,11 +168,24 @@ ${cactusPlugin.getDependency('cactus').getVersion()} - + + + + + + + + + + + + + + @@ -179,12 +208,24 @@ - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/eclipse/src/plugin-test/maven.xml b/eclipse/src/plugin-test/maven.xml index db129216..9fec4257 100644 --- a/eclipse/src/plugin-test/maven.xml +++ b/eclipse/src/plugin-test/maven.xml @@ -20,7 +20,7 @@ xmlns:u="jelly:util" xmlns:x="jelly:xml"> - + @@ -38,10 +38,10 @@ - + - + @@ -111,7 +111,7 @@ - + @@ -128,6 +128,18 @@ - + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse/src/plugin-test/project.xml b/eclipse/src/plugin-test/project.xml index 12f97b2b..02c044e9 100644 --- a/eclipse/src/plugin-test/project.xml +++ b/eclipse/src/plugin-test/project.xml @@ -81,4 +81,32 @@ 13-1.6.1 + + src/main + src/test + + + **/TestAll.java + + + + src/test-resources + false + + + + + + src/main + + + src/resources + + **/*.properties + **/*.xml + + false + + + diff --git a/eclipse/src/plugin-test/src/main/dir.txt b/eclipse/src/plugin-test/src/main/dir.txt new file mode 100644 index 00000000..1e0c6675 --- /dev/null +++ b/eclipse/src/plugin-test/src/main/dir.txt @@ -0,0 +1 @@ +needed for plugin test diff --git a/eclipse/src/plugin-test/src/test/dir.txt b/eclipse/src/plugin-test/src/test/dir.txt new file mode 100644 index 00000000..dea0a88a --- /dev/null +++ b/eclipse/src/plugin-test/src/test/dir.txt @@ -0,0 +1 @@ +needed for plugin test \ No newline at end of file diff --git a/eclipse/xdocs/changes.xml b/eclipse/xdocs/changes.xml index 673e61eb..b9e5957a 100644 --- a/eclipse/xdocs/changes.xml +++ b/eclipse/xdocs/changes.xml @@ -25,6 +25,8 @@ + duplicate build path added if resouce directory is the same as java source dir. + Simple implementation of handling source artifacts. Add resources directories and test resources directories to .classpath. Overriden jar that resides outside maven repo doesn't get resolved properly. Jar overrides are now properly supported. diff --git a/eclipse/xdocs/goals.xml b/eclipse/xdocs/goals.xml index dbe6d8f9..e3e2afe3 100644 --- a/eclipse/xdocs/goals.xml +++ b/eclipse/xdocs/goals.xml @@ -64,6 +64,7 @@
  • an output directory for compiled code: target\classes
  • +
  • any .zip source archives
  • diff --git a/eclipse/xdocs/index.xml b/eclipse/xdocs/index.xml index d996a6ae..7c02aa24 100644 --- a/eclipse/xdocs/index.xml +++ b/eclipse/xdocs/index.xml @@ -42,5 +42,83 @@ document.

    + +
    +

    + The dependencies defined in the POM need not to be jars strictly. They can + be projects in the eclipse workspace. If a dependency is an eclipse project + a property needs to be added to that dependency to indicate so. +

    + + group + artifact + version + + true + + +]]> +

    + This indicates that the dependency is another project in the workspace. + Note that the name of the referenced project is the artifactId. +

    +

    + The inverse also works. If you have included extra jars that shouldn't be + in the eclipse classpath then you can set eclipse.dependency=false +

    +
    +
    + +

    + Frequently you will want to include for compiled jars the source .java files to help + with debugging. +

    +

    + The plugin will check if the file specified is located in MAVEN_REPO/${groupId}/src/ directory + and ending in maven.eclipse.src.extension exists and will add it as a source attachment. + Using default values the dependency MAVEN_REPO/eclipse/jars/eclipse-ui-3.0.0.jar + will be mapped to MAVEN_REPO/eclipse/src/eclipse-ui-3.0.0.zip +

    +

    + While this implementation isn't the perfect solution, for example no downloading of + source .zip files, it is a minimal solution that will work now. Future versions + of Maven will have more sophisticated solutions for dealing with source code. There is + no guarantee that this implementation will remain in later versions of Maven and this + plugin. +

    +
    + +

    + When Eclipse is not generating source code for you there is a conflict between + Maven generating the source code and then Eclipse treating it as compiled code. + Typically when generating code using Maven the code ends up in the target/classes + directory. This is fine as long as Maven is doing the build. However, if Eclipse + is then setup to do the build, when Eclipse performs a clean build all the generated + code in target/classes will be removed. +

    +

    + The alternatives typically are to place the generated code in the /src/java directory + and allow Maven and Eclipse to treat it the same. However, this leads to a tendency + to check generated code into source control, which typically is not appropriate for + generated code. Alternatively, it can be placed in some sort of /src/generated or + target/generated directory. In Maven2, generated code lives in target/generated-sources, + in a manner similiar to generated xdoc's live in target/generated-xdocs. Within the + target/generated-sources would be each type of generated code. +

    +

    + For example, if you used the XDoclet Plugin for Maven to generate Hibernate mapping files, + they would be placed in /target/generated-sources/xdoclet/. While, if you used the + Hibernate Plugin for Maven to generate the SQL scripts for generating a database then that + would be placed in /target/generated-sources/schema/. +
    + Settings in project.properties: + +maven.xdoclet.hibernatedoclet.destDir=${maven.build.dir}/generated-sources/xdoclet +maven.hibernate.output.dir=${maven.build.dir}/generated-sources/schema + +

    +
    +
    diff --git a/eclipse/xdocs/properties.xml b/eclipse/xdocs/properties.xml index 2da42f58..6930b82f 100644 --- a/eclipse/xdocs/properties.xml +++ b/eclipse/xdocs/properties.xml @@ -108,6 +108,13 @@ the generated code to be clearly in the build directory. + + maven.eclipse.src.extension + Yes (default=zip) + + The extension used for source attachments. + +

    Note that you will need to defined a MAVEN_REPO Java @@ -117,61 +124,6 @@ MAVEN_REPO that points to your local Maven repository.

    -
    -

    - The dependencies defined in the POM need not to be jars strictly. They can - be projects in the eclipse workspace. If a dependency is an eclipse project - a property needs to be added to that dependency to indicate so. -

    - - group - artifact - version - - true - - -]]> -

    - This indicates that the dependency is another project in the workspace. - Note that the name of the referenced project is the artifactId. -

    -

    - The inverse also works. If you have included extra jars that shouldn't be - in the eclipse classpath then you can set eclipse.dependency=false -

    -
    -
    -

    - When Eclipse is not generating source code for you there is a conflict between - Maven generating the source code and then Eclipse treating it as compiled code. - Typically when generating code using Maven the code ends up in the target/classes - directory. This is fine as long as Maven is doing the build. However, if Eclipse - is then setup to do the build, when Eclipse performs a clean build all the generated - code in target/classes will be removed. -

    -

    - The alternatives typically are to place the generated code in the /src/java directory - and allow Maven and Eclipse to treat it the same. However, this leads to a tendency - to check generated code into source control, which typically is not appropriate for - generated code. Alternatively, it can be placed in some sort of /src/generated or - target/generated directory. In Maven2, generated code lives in target/generated-sources, - in a manner similiar to generated xdoc's live in target/generated-xdocs. Within the - target/generated-sources would be each type of generated code. -

    -

    - For example, if you used the XDoclet Plugin for Maven to generate Hibernate mapping files, - they would be placed in /target/generated-sources/xdoclet/. While, if you used the - Hibernate Plugin for Maven to generate the SQL scripts for generating a database then that - would be placed in /target/generated-sources/schema/. -
    - Settings in project.properties: - -maven.xdoclet.hibernatedoclet.destDir=${maven.build.dir}/generated-sources/xdoclet -maven.hibernate.output.dir=${maven.build.dir}/generated-sources/schema - -

    -
    +