Maven
  1. Maven
  2. MNG-3672

maven 2 fails to compile some projects (doesn't include any dependencies in classpath)

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.9, 3.0
    • Fix Version/s: None
    • Component/s: Dependencies
    • Labels:
      None
    • Environment:
      Microsoft Windows XP [Version 5.1.2600]
    • Complexity:
      Intermediate
    • Number of attachments :
      3

      Description

      Try to compile the trivial project attached (w/ possibly non-trivial dependencies).

      Note: you may have to manually install some of the dependencies; pdf-box is probably the only one like that. But you removing it from pom doesn't appear to resolve the issue either, so you can probably just remove it.

        Activity

        Hide
        Reshat Sabiq added a comment - - edited

        The project successfully builds from Eclipse w/ Q for Eclipse plugin.
        It also successfully builds w/ maven 1, using project.xml in the attachment.

        Show
        Reshat Sabiq added a comment - - edited The project successfully builds from Eclipse w/ Q for Eclipse plugin. It also successfully builds w/ maven 1, using project.xml in the attachment.
        Hide
        Reshat Sabiq added a comment - - edited

        Use maven-2-bug-cleaner.zip instead of maven-2-bug.zip to reproduce, because it is a bit cleaner, and actually prints stuff from log4j, if executed.

        Show
        Reshat Sabiq added a comment - - edited Use maven-2-bug-cleaner.zip instead of maven-2-bug.zip to reproduce, because it is a bit cleaner, and actually prints stuff from log4j, if executed.
        Hide
        Reshat Sabiq added a comment -

        maven-2-bug-cleaner-with-pdfbox.zip is the same as maven-2-bug-cleaner.zip, but has a pdfbox dependency.

        Show
        Reshat Sabiq added a comment - maven-2-bug-cleaner-with-pdfbox.zip is the same as maven-2-bug-cleaner.zip, but has a pdfbox dependency.
        Hide
        Benjamin Bentmann added a comment -

        Your POM states

        <dependency>
        	<groupId>log4j</groupId>
        	<artifactId>log4j</artifactId>
        	<version>1.2.12</version>
        	<scope>runtime</scope>
        </dependency>
        

        Note the <scope> element. You are effectively telling Maven that Log4J is only required for running (and testing) the project. However, you need it for compilation. So either change the affected dependencies to <scope>compile</scope> or simply remove the <scope> element.

        Show
        Benjamin Bentmann added a comment - Your POM states <dependency> <groupId> log4j </groupId> <artifactId> log4j </artifactId> <version> 1.2.12 </version> <scope> runtime </scope> </dependency> Note the <scope> element. You are effectively telling Maven that Log4J is only required for running (and testing) the project. However, you need it for compilation. So either change the affected dependencies to <scope>compile</scope> or simply remove the <scope> element.
        Hide
        Benjamin Bentmann added a comment -

        The project successfully builds from Eclipse w/ Q for Eclipse plugin.

        Keep in mind that Eclipse has only one build path, i.e. does not distinguish between compile, runtime and test class path. As such, all dependencies end up on your Eclipse build path, obscuring the effect of a bad POM.

        Show
        Benjamin Bentmann added a comment - The project successfully builds from Eclipse w/ Q for Eclipse plugin. Keep in mind that Eclipse has only one build path, i.e. does not distinguish between compile, runtime and test class path. As such, all dependencies end up on your Eclipse build path, obscuring the effect of a bad POM.
        Hide
        Reshat Sabiq added a comment -

        I was under mistaken assumption that runtime scope included compile scope. My bad. Closing...

        Show
        Reshat Sabiq added a comment - I was under mistaken assumption that runtime scope included compile scope. My bad. Closing...
        Hide
        Reshat Sabiq added a comment -

        Runtime scope doesn't include compile scope: bad pom, not a bug.

        Show
        Reshat Sabiq added a comment - Runtime scope doesn't include compile scope: bad pom, not a bug.

          People

          • Assignee:
            Unassigned
            Reporter:
            Reshat Sabiq
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: