Maven 1.x Eclipse Plugin
  1. Maven 1.x Eclipse Plugin
  2. MPECLIPSE-103

Allow to skip dependencies from being included in .classpath file

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Need a means to specify that some maven dependencies are NOT included in the generated .classpath file.

      Reason: Maven builds a project. This may include generating source via castor, InjectJ, etc.
      Once the source code is generated, the generated source may not depend on the various jars that helped generate it.
      That means, the Eclipse project should not depend on these jars. Currently, it is not possible to exclude these jars.

      Can you add an additional property, like <eclipse.classpath.include>no</eclipse.classpath.include>, which will
      not add the dependency to the generated classpath file.

        Activity

        Hide
        Trygve Laugstøl added a comment -

        I don't see how this can happen as the dependencies used to generate the source code will be dependencies of the plugin, not the project. Are you sure that this is what actually is happening?

        Show
        Trygve Laugstøl added a comment - I don't see how this can happen as the dependencies used to generate the source code will be dependencies of the plugin, not the project. Are you sure that this is what actually is happening?
        Hide
        Werner Schulz added a comment -

        Yes, the dependencies listed in the project are all included in the Eclipse classpath file.

        From the Maven Eclipse Plugin documentation (see http://maven.apache.org/reference/plugins/eclipse/goals.html):

        Goal: eclipse:generate-classpath

        Description: Generates a .classpath file for the eclipse project with classpath entries for
        1. the build source directory
        2. the build unit test source directory
        3. the JRE being used
        4. the appropriate version of JUnit
        5. each Maven project dependency
        6. an output directory for compiled code: target\classes
        7. any .zip source archives

        The problem is item 5.

        In my project, we generate some enumerations using Castor (using xerces-2.4). The generated
        code is completely independent of XML or Castor.
        The generated enumerations are needed in code that also accesses some proprietary stuff
        which relies on an older version of xerces. Suddenly, Eclipse gets confused because the required
        presence of castor and xerces dependencies in the project file (castor plugin doesn't seem to find
        the necessary jars on its own!?) conflict with dependencies from other code bits.

        This is an example where build and development dependency requirements are different but this
        is not recognised by the eclipse plugin.

        Show
        Werner Schulz added a comment - Yes, the dependencies listed in the project are all included in the Eclipse classpath file. From the Maven Eclipse Plugin documentation (see http://maven.apache.org/reference/plugins/eclipse/goals.html): Goal: eclipse:generate-classpath Description: Generates a .classpath file for the eclipse project with classpath entries for 1. the build source directory 2. the build unit test source directory 3. the JRE being used 4. the appropriate version of JUnit 5. each Maven project dependency 6. an output directory for compiled code: target\classes 7. any .zip source archives The problem is item 5. In my project, we generate some enumerations using Castor (using xerces-2.4). The generated code is completely independent of XML or Castor. The generated enumerations are needed in code that also accesses some proprietary stuff which relies on an older version of xerces. Suddenly, Eclipse gets confused because the required presence of castor and xerces dependencies in the project file (castor plugin doesn't seem to find the necessary jars on its own!?) conflict with dependencies from other code bits. This is an example where build and development dependency requirements are different but this is not recognised by the eclipse plugin.
        Hide
        fabrizio giustina added a comment -

        > In my project, we generate some enumerations using Castor (using xerces-2.4). The generated
        > code is completely independent of XML or Castor.

        If I understood correclty, you added the castor dependency in order to generate source code: the castor dependency, however, should not be a project dependency but a plugin dependency. For example this should work if you are using the maven castor plugin at http://maven.apache.org/maven-1.x/reference/plugins/castor/index.html (do you?).

        If you are using a custom ant task you will need castor and xerces in the classpath, but this is not the recommended way.
        First of all, castor will be in the classpath used by maven when executing tests, and this is the same situation you are seeing in eclipse (so, it SHOULD fail in eclipse if it fails with maven).

        As a solution you should:

        • use a plugin to generate sources and, if such plugin doesn't exist, extract your code from maven.xml and put it in a plugin (recommended)
        • manually modify the classpath before calling the ant task used to generate sources, removing the castor jar from project.xml
        Show
        fabrizio giustina added a comment - > In my project, we generate some enumerations using Castor (using xerces-2.4). The generated > code is completely independent of XML or Castor. If I understood correclty, you added the castor dependency in order to generate source code: the castor dependency, however, should not be a project dependency but a plugin dependency. For example this should work if you are using the maven castor plugin at http://maven.apache.org/maven-1.x/reference/plugins/castor/index.html (do you?). If you are using a custom ant task you will need castor and xerces in the classpath, but this is not the recommended way. First of all, castor will be in the classpath used by maven when executing tests, and this is the same situation you are seeing in eclipse (so, it SHOULD fail in eclipse if it fails with maven). As a solution you should: use a plugin to generate sources and, if such plugin doesn't exist, extract your code from maven.xml and put it in a plugin (recommended) manually modify the classpath before calling the ant task used to generate sources, removing the castor jar from project.xml

          People

          • Assignee:
            fabrizio giustina
            Reporter:
            Werner Schulz
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: