Hi,
usually when project.name is not set, it defaults to project.artifactId.
But when I set <build><directory>${project.name}</directory></build>, it
seems to not use the default in some places.
Setup:
- project.name is not explicitly set
- project.build.directory set to ${project.name}
- a Java class under src/main
- a unit test under src/test
Example project:
https://code.google.com/p/outsidedirectorywithname/source/browse/
Reproduce problem:
mvn -X clean test
Result:
Build fails during compilation of unit test:
COMPILATION ERROR :
[ERROR]
\opt\gitrepos\outsidedirectorywithname\src\test\java\com\example\outsidedirectorywithname\GreeterTest.java:[3,43]
error: cannot find symbol
Complete output:
https://code.google.com/p/outsidedirectorywithname/source/browse/output-failed-build.txt
When I echo project.name with antrun, it defaults to project.artifactId as
expected.
When I set project.name in pom.xml, the build succeeds. Complete fixed
output:
https://code.google.com/p/outsidedirectorywithname/source/browse/output-fixed-by-setting-project-name.txt
In the debug output (-X) I see places where "${project.name}" appears, for
example
[DEBUG] (f) classpathElements =
[C:\opt\gitrepos\outsidedirectorywithname\${project.name}\classes]
When I set project.name, this works fine:
[DEBUG] (f) classpathElements =
[C:\opt\gitrepos\outsidedirectorywithname\outsidedirectorywithname\classes]
Why doesn't project.name default to project.artifactId in this case? Is
this a bug? Or is there a reason why I cannot rely on the default value
here?
Regards,
Arend v. Reinersdorff
usually when project.name is not set, it defaults to project.artifactId.
But when I set <build><directory>${project.name}</directory></build>, it
seems to not use the default in some places.
Setup:
- project.name is not explicitly set
- project.build.directory set to ${project.name}
- a Java class under src/main
- a unit test under src/test
Example project:
https://code.google.com/p/outsidedirectorywithname/source/browse/
Reproduce problem:
mvn -X clean test
Result:
Build fails during compilation of unit test:
COMPILATION ERROR :
[ERROR]
\opt\gitrepos\outsidedirectorywithname\src\test\java\com\example\outsidedirectorywithname\GreeterTest.java:[3,43]
error: cannot find symbol
Complete output:
https://code.google.com/p/outsidedirectorywithname/source/browse/output-failed-build.txt
When I echo project.name with antrun, it defaults to project.artifactId as
expected.
When I set project.name in pom.xml, the build succeeds. Complete fixed
output:
https://code.google.com/p/outsidedirectorywithname/source/browse/output-fixed-by-setting-project-name.txt
In the debug output (-X) I see places where "${project.name}" appears, for
example
[DEBUG] (f) classpathElements =
[C:\opt\gitrepos\outsidedirectorywithname\${project.name}\classes]
When I set project.name, this works fine:
[DEBUG] (f) classpathElements =
[C:\opt\gitrepos\outsidedirectorywithname\outsidedirectorywithname\classes]
Why doesn't project.name default to project.artifactId in this case? Is
this a bug? Or is there a reason why I cannot rely on the default value
here?
Regards,
Arend v. Reinersdorff