Maven
  1. Maven
  2. MNG-3355

CLONE -${pom.build.sourceDirectory} and ${pom.build.testSourceDirectory} no longer recognized

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.9
    • Component/s: POM
    • Labels:
      None
    • Environment:
      n/a
    • Complexity:
      Intermediate
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      The properties $

      {pom.build.sourceDirectory} and ${pom.build.testSourceDirectory} (and perhaps others as well) are no longer recognized in pom.xml. The following pom fragment had the desired effect of copying resources from the sourceDirectory in version 2.0.3, but doesn't work in 2.0.4:

      <build>
      <sourceDirectory>src</sourceDirectory>
      <testSourceDirectory>src-test</testSourceDirectory>
      <resources>
      <resource>
      <directory>${pom.build.sourceDirectory}

      </directory>
      <includes>
      <include>*/.properties</include>
      </includes>
      </resource>
      </resources>
      <testResources>
      <testResource>
      <directory>$

      {pom.build.testSourceDirectory}

      </directory>
      <includes>
      <include>**/mockfiles/</include>
      </includes>
      </testResource>
      </testResources>

      The attached project will fail on a 'mvn test' under maven 2.0.4 and succeed under 2.0.3

        Issue Links

          Activity

          Hide
          Venelin Mitov added a comment -

          Hello All,

          This issue is a cloning of http://jira.codehaus.org/browse/MNG-2220. I cloned this one as it was closed and I guess noone is likely to read my recent post on it.

          I used the attached buglet.zip project to reproduce the problem on versions 2.0.5, 2.0.7 and 2.0.8 of maven. Here is the output I got when executing mvn clean test.

          $ /cygdrive/c/maven/maven-2.0.8/bin/mvn clean test
          [INFO] Scanning for projects...
          [INFO] ------------------------------------------------------------------------
          [INFO] Building Unnamed - maven:buglet:jar:01.01-SNAPSHOT
          [INFO] task-segment: [clean, test]
          [INFO] ------------------------------------------------------------------------
          [INFO] artifact org.apache.maven.plugins:maven-clean-plugin: checking for updates from internal
          [INFO] [clean:clean]
          [INFO] Deleting directory c:\adhoc\buglet\target
          [INFO] Deleting directory c:\adhoc\buglet\target\classes
          [INFO] Deleting directory c:\adhoc\buglet\target\test-classes
          [INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking for updates from internal
          [INFO] artifact org.apache.maven.plugins:maven-compiler-plugin: checking for updates from internal
          [INFO] artifact org.apache.maven.plugins:maven-surefire-plugin: checking for updates from internal
          [INFO] [resources:resources]
          [INFO] Using default encoding to copy filtered resources.
          [INFO] [compiler:compile]
          [INFO] Nothing to compile - all classes are up to date
          [INFO] [resources:testResources]
          [INFO] Using default encoding to copy filtered resources.
          [INFO] [compiler:testCompile]
          [INFO] Compiling 1 source file to c:\adhoc\buglet\target\test-classes
          [INFO] [surefire:test]
          [INFO] Surefire report directory: c:\adhoc\buglet\target\surefire-reports

          -------------------------------------------------------
          T E S T S
          -------------------------------------------------------
          Running BugletTest
          Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.187 sec <<< FAILURE!

          Results :

          Tests in error:
          testOne(BugletTest)

          Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

          [INFO] ------------------------------------------------------------------------
          [ERROR] BUILD FAILURE
          [INFO] ------------------------------------------------------------------------
          [INFO] There are test failures.
          [INFO] ------------------------------------------------------------------------
          [INFO] For more information, run Maven with the -e switch
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 7 seconds
          [INFO] Finished at: Mon Jan 07 11:43:01 CET 2008
          [INFO] Final Memory: 6M/13M
          [INFO] ------------------------------------------------------------------------

          And this is the test error:

          mitovv@GM02442 /cygdrive/c/adhoc/buglet
          $ less target/surefire-reports/*.txt
          -------------------------------------------------------------------------------
          Test set: BugletTest
          -------------------------------------------------------------------------------
          Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.109 sec <<< FAILURE!
          testOne(BugletTest) Time elapsed: 0 sec <<< ERROR!
          java.lang.NullPointerException
          at java.io.Reader.<init>(Reader.java:74)
          at java.io.InputStreamReader.<init>(InputStreamReader.java:118)
          at java.util.Properties.load(Properties.java:298)
          at BugletTest.testOne(BugletTest.java:10)
          at BugletTest.testOne(BugletTest.java:10)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
          at java.lang.reflect.Method.invoke(Method.java:391)
          at junit.framework.TestCase.runTest(TestCase.java:154)
          at junit.framework.TestCase.runBare(TestCase.java:127)
          at junit.framework.TestResult$1.protect(TestResult.java:106)
          at junit.framework.TestResult.runProtected(TestResult.java:124)
          at junit.framework.TestResult.run(TestResult.java:109)
          at junit.framework.TestCase.run(TestCase.java:118)
          at junit.framework.TestSuite.runTest(TestSuite.java:208)
          at junit.framework.TestSuite.run(TestSuite.java:203)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
          at java.lang.reflect.Method.invoke(Method.java:391)
          at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
          at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
          at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
          at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
          at java.lang.reflect.Method.invoke(Method.java:391)
          at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
          at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)

          This is the jvm I use:
          Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
          Classic VM (build 1.4.2, J2RE 1.4.2 IBM Windows 32 build cn142-20060421 (SR5) (JIT enabled: jitc))

          Kind regards,
          Venelin Mitov

          Show
          Venelin Mitov added a comment - Hello All, This issue is a cloning of http://jira.codehaus.org/browse/MNG-2220 . I cloned this one as it was closed and I guess noone is likely to read my recent post on it. I used the attached buglet.zip project to reproduce the problem on versions 2.0.5, 2.0.7 and 2.0.8 of maven. Here is the output I got when executing mvn clean test. $ /cygdrive/c/maven/maven-2.0.8/bin/mvn clean test [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Unnamed - maven:buglet:jar:01.01-SNAPSHOT [INFO] task-segment: [clean, test] [INFO] ------------------------------------------------------------------------ [INFO] artifact org.apache.maven.plugins:maven-clean-plugin: checking for updates from internal [INFO] [clean:clean] [INFO] Deleting directory c:\adhoc\buglet\target [INFO] Deleting directory c:\adhoc\buglet\target\classes [INFO] Deleting directory c:\adhoc\buglet\target\test-classes [INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking for updates from internal [INFO] artifact org.apache.maven.plugins:maven-compiler-plugin: checking for updates from internal [INFO] artifact org.apache.maven.plugins:maven-surefire-plugin: checking for updates from internal [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] Nothing to compile - all classes are up to date [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:testCompile] [INFO] Compiling 1 source file to c:\adhoc\buglet\target\test-classes [INFO] [surefire:test] [INFO] Surefire report directory: c:\adhoc\buglet\target\surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running BugletTest Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.187 sec <<< FAILURE! Results : Tests in error: testOne(BugletTest) Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 [INFO] ------------------------------------------------------------------------ [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] There are test failures. [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7 seconds [INFO] Finished at: Mon Jan 07 11:43:01 CET 2008 [INFO] Final Memory: 6M/13M [INFO] ------------------------------------------------------------------------ And this is the test error: mitovv@GM02442 /cygdrive/c/adhoc/buglet $ less target/surefire-reports/*.txt ------------------------------------------------------------------------------- Test set: BugletTest ------------------------------------------------------------------------------- Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.109 sec <<< FAILURE! testOne(BugletTest) Time elapsed: 0 sec <<< ERROR! java.lang.NullPointerException at java.io.Reader.<init>(Reader.java:74) at java.io.InputStreamReader.<init>(InputStreamReader.java:118) at java.util.Properties.load(Properties.java:298) at BugletTest.testOne(BugletTest.java:10) at BugletTest.testOne(BugletTest.java:10) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125) at org.apache.maven.surefire.Surefire.run(Surefire.java:132) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818) This is the jvm I use: Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2) Classic VM (build 1.4.2, J2RE 1.4.2 IBM Windows 32 build cn142-20060421 (SR5) (JIT enabled: jitc)) Kind regards, Venelin Mitov
          Hide
          Brett Porter added a comment -

          this is a result of the hack put in place to resolve the MNG-1927/MNG-2124 issues as commented in the code

          Show
          Brett Porter added a comment - this is a result of the hack put in place to resolve the MNG-1927 / MNG-2124 issues as commented in the code
          Hide
          John Casey added a comment -

          I've added translated paths to the context overrides for references to build directories during model interpolation, to allow expressions referencing these values to be interpolated as translated, not as raw values. Normal path translation still happens later, to catch those build directories that don't themselves contain expressions referencing other directory overrides from the context.

          Translation: If the POM file is from a local build directory (not a repository), use the path-translated version of build.directory, build.outputDirectory, build.sourceDirectory and so on the first time through, rather than depending on some secondary process to manage this after the main path-translation sweep later in the project-construction process.

          This has been applied to both the 2.0.x and trunk code lines.

          Show
          John Casey added a comment - I've added translated paths to the context overrides for references to build directories during model interpolation, to allow expressions referencing these values to be interpolated as translated, not as raw values. Normal path translation still happens later, to catch those build directories that don't themselves contain expressions referencing other directory overrides from the context. Translation: If the POM file is from a local build directory (not a repository), use the path-translated version of build.directory, build.outputDirectory, build.sourceDirectory and so on the first time through, rather than depending on some secondary process to manage this after the main path-translation sweep later in the project-construction process. This has been applied to both the 2.0.x and trunk code lines.

            People

            • Assignee:
              John Casey
              Reporter:
              Venelin Mitov
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: