You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Lars Fischer <lf...@fastmail.fm> on 2010/11/17 10:27:35 UTC

[m3] property ${project.build.directory} returns defect path

Hello,

I use Maven v3.0.0 and would like to use the property
"${project.build.directory}" inside commandlineArgs of the
"exec-maven-plugin".

My configuration looks like this:
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.1</version>
  <executions>
    <execution>
      <id>test</id>
      <goals>
        <goal>exec</goal>
      </goals>
      <phase>install</phase>
      <configuration>
        <executable>echo</executable>
        <commandlineArgs>${project.build.directory}</commandlineArgs>
      </configuration>
    </execution>
  </executions>
</plugin>

As result the path to the target folder of the build project is printed.

But there is a major problem: the path does not contain any "/" or "\". It
looks like
"D:developmentprojectstesttarget" but should be
"D:\development\projects\test\target"

Where is my mistake?

Kind regards,
Lars

Re: [m3] property ${project.build.directory} returns defect path

Posted by Maxime Gréau <gr...@gmail.com>.
ok, it's good to know.

Maxime.

2010/11/17 Lars Fischer <lf...@fastmail.fm>

> The windows path bug is fixed in 1.2:
> http://jira.codehaus.org/browse/MEXEC-81
>
> Kind regards,
> Lars
>

Re: [m3] property ${project.build.directory} returns defect path

Posted by Lars Fischer <lf...@fastmail.fm>.
The windows path bug is fixed in 1.2:
http://jira.codehaus.org/browse/MEXEC-81

Kind regards,
Lars

Re: [m3] property ${project.build.directory} returns defect path

Posted by Lars Fischer <lf...@fastmail.fm>.
I switched to exec-maven-plugin version 1.2. But now I get an error:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec
(test2) on project test.test: Command
 execution failed. Cannot run program "echo" (in directory
"D:\development\projects\test")

Kind regards,
Lars

>

Re: [m3] property ${project.build.directory} returns defect path

Posted by Lars Fischer <lf...@fastmail.fm>.
Hello Maxime,

2010/11/17 Maxime Gréau <gr...@gmail.com>

>
> I tested your configuration and it works fine for me (Apache Maven 3.0
> and exec-maven-plugin-1.0)
>
> First, you can execute : mvn help:effective-pom
> You will see the real path returned by the property
> ${project.build.directory}.


This is the output after calling "mvn help:effective-pom install" using
"${project.build.directory}"

[...]
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.1</version>
  <executions>
    <execution>
      <id>test2</id>
      <phase>install</phase>
      <goals>
        <goal>exec</goal>
      </goals>
      <configuration>
        <executable>echo</executable>

<commandlineArgs>D:\development\projects\test\target</commandlineArgs>
      </configuration>
    </execution>
  </executions>
</plugin>
[...]
[INFO] --- exec-maven-plugin:1.1:exec (test2) @ test ---
[INFO] D:developmentprojectstesttarget



I changed my configuration and used the correct Windows-path directly:
<commandlineArgs>D:\development\projects\test\target</commandlineArgs>

And the output is still wrong.


Next I changed "\" to "/":
<commandlineArgs>D:/development/projects/test/target</commandlineArgs>

And now I get the complete path:
"[INFO] D:/development/projects/test/target"


Looks like a bug inside the exec-maven-plugin, which filters all "\"
characters.


Kind regards,
Lars

Re: [m3] property ${project.build.directory} returns defect path

Posted by Maxime Gréau <gr...@gmail.com>.
Hello,

I tested your configuration and it works fine for me (Apache Maven 3.0
and exec-maven-plugin-1.0)

First, you can execute : mvn help:effective-pom
You will see the real path returned by the property
${project.build.directory}.

2010/11/17 Lars Fischer <lf...@fastmail.fm>

> Hello,
>
> I use Maven v3.0.0 and would like to use the property
> "${project.build.directory}" inside commandlineArgs of the
> "exec-maven-plugin".
>
> My configuration looks like this:
> <plugin>
>  <groupId>org.codehaus.mojo</groupId>
>  <artifactId>exec-maven-plugin</artifactId>
>  <version>1.1</version>
>  <executions>
>    <execution>
>      <id>test</id>
>      <goals>
>        <goal>exec</goal>
>      </goals>
>      <phase>install</phase>
>      <configuration>
>        <executable>echo</executable>
>        <commandlineArgs>${project.build.directory}</commandlineArgs>
>      </configuration>
>    </execution>
>  </executions>
> </plugin>
>
> As result the path to the target folder of the build project is printed.
>
> But there is a major problem: the path does not contain any "/" or "\". It
> looks like
> "D:developmentprojectstesttarget" but should be
> "D:\development\projects\test\target"
>
> Where is my mistake?
>
> Kind regards,
> Lars
>