Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-4083

project.build.directory not set properly for plugins

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.0.9, 2.0.10
    • None
    • Settings
    • None
    • Windows XP

    Description

      Maven 2.0.9 and above do not seem to set project.build.directory properly in down stream plugins. I have the below test case that shows the problem in the ant plugin, but I have also seen in in the javadoc plugin. Below is my test case and the results as seen from 2.0.7, 2.0.8, 2.0.9, and 2.0.10.

      Test POM:

      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

      <modelVersion>4.0.0</modelVersion>
      <groupId>test</groupId>
      <artifactId>test</artifactId>
      <packaging>jar</packaging>
      <version>1.0.0</version>
      <name>Foo</name>
      <properties>
      <djobj>E:\obj</djobj>
      </properties>
      <build>
      <defaultGoal>package</defaultGoal>
      <outputDirectory>${djobj}/${project.artifactId}/classes</outputDirectory>
      <testOutputDirectory>${djobj}/${project.artifactId}/test-classes</testOutputDirectory>
      <directory>${djobj}/${project.artifactId}</directory>
      <plugins>
      <plugin>
      <artifactId>maven-antrun-plugin</artifactId>
      <executions>
      <execution>
      <phase>package</phase>
      <configuration>
      <tasks>
      <echo message="Debug data"/>
      <echo message="basedir = ${basedir}"/>
      <echo message="djobj = ${djobj}"/>
      <echo message="project.build.sourceDirectory = ${project.build.sourceDirectory}"/>
      <echo message="project.build.scriptSourceDirectory = ${project.build.scriptSourceDirectory}"/>
      <echo message="project.build.testSourceDirectory = ${project.build.testSourceDirectory}"/>
      <echo message="project.build.outputDirectory = ${project.build.outputDirectory}"/>
      <echo message="project.build.testOutputDirectory = ${project.build.testOutputDirectory}"/>
      <echo message="project.build.directory = ${project.build.directory}"/>
      </tasks>
      </configuration>
      <goals>
      <goal>run</goal>
      </goals>
      </execution>
      </executions>
      </plugin>
      </plugins>
      </build>
      </project>

      Test output:

      Maven 2.0.7

      [INFO] [antrun:run

      {execution: default}

      ]
      [INFO] Executing tasks
      [echo] Debug data
      [echo] basedir = E:\foo
      [echo] djobj = E:\obj
      [echo] project.build.sourceDirectory = E:\foo\src\main\java
      [echo] project.build.scriptSourceDirectory = src/main/scripts
      [echo] project.build.testSourceDirectory = E:\foo\src\test\java
      [echo] project.build.outputDirectory = E:\obj/test/classes
      [echo] project.build.testOutputDirectory = E:\obj/test/test-classes
      [echo] project.build.directory = E:\obj/test
      [INFO] Executed tasks

      Maven 2.0.8

      [INFO] [antrun:run

      {execution: default}

      ]
      [INFO] Executing tasks
      [echo] Debug data
      [echo] basedir = E:\foo
      [echo] djobj = E:\obj
      [echo] project.build.sourceDirectory = E:\foo\src\main\java
      [echo] project.build.scriptSourceDirectory = src/main/scripts
      [echo] project.build.testSourceDirectory = E:\foo\src\test\java
      [echo] project.build.outputDirectory = E:\obj/test/classes
      [echo] project.build.testOutputDirectory = E:\obj/test/test-classes
      [echo] project.build.directory = E:\obj/test
      [INFO] Executed tasks

      Maven 2.0.9

      [INFO] [antrun:run

      {execution: default}

      ]
      [INFO] Executing tasks
      [echo] Debug data
      [echo] basedir = E:\foo
      [echo] djobj = E:\obj
      [echo] project.build.sourceDirectory = E:\foo\src\main\java
      [echo] project.build.scriptSourceDirectory = src/main/scripts
      [echo] project.build.testSourceDirectory = E:\foo\src\test\java
      [echo] project.build.outputDirectory = E:\foo\E:\obj\test\classes
      [echo] project.build.testOutputDirectory = E:\foo\E:\obj\test\test-classes
      [echo] project.build.directory = E:\foo\E:\obj\test
      [INFO] Executed tasks

      Maven 2.0.10

      [INFO] [antrun:run

      {execution: default}

      ]
      [INFO] Executing tasks
      [echo] Debug data
      [echo] basedir = E:\foo
      [echo] djobj = E:\obj
      [echo] project.build.sourceDirectory = E:\foo\src\main\java
      [echo] project.build.scriptSourceDirectory = src/main/scripts
      [echo] project.build.testSourceDirectory = E:\foo\src\test\java
      [echo] project.build.outputDirectory = E:\foo\E:\obj\test\classes
      [echo] project.build.testOutputDirectory = E:\foo\E:\obj\test\test-classes
      [echo] project.build.directory = E:\foo\E:\obj\test
      [INFO] Executed tasks

      Attachments

        Issue Links

          Activity

            People

              brett Brett Porter
              jmccaske jmccaske
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: