maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agfung <agf...@gmail.com>
Subject "<targetPath/>" for <resource> behaves differently Windows v. Linux
Date Wed, 20 Mar 2013 18:48:42 GMT
Running "mvn compile" on the attached build (basically the POM below and a
/src/main/resources/placeholder.txt/), I get different behaviour on Windows
v Linux (tried combinations of Maven 3.0.4/3.0.5, Win7 x64/Ubuntu12.10 x64,
openjdk 1.6/1.7).

On Windows, it compiles fine.  On Linux, it tries to copy the resources to
the root directory instead of the build output directory tree.  It fails
because the account I'm running under doesn't have permissions to write
there.

I tried attaching a debugger, and the furthest I got was stepping through
/maven-filtering-1.0-beta-2 /, and seeing that in
/DefaultMavenResourcesFiltering/, /Resource.getTargetPath()/ returns null on
Windows, and "" on Linux.  Why that is, I don't know.

Returning "" triggers the null-check logic that basically says "if
targetPath is not null, append a slash".  But if /targetPath/ is an empty
string, this creates a destination filename that resides in the root
directory.

The workaround is straightforward - remove the redundant "<targetPath/>"
element, since the default behaviour is the same - but I just wanted to
confirm if this is a bug, or something I don't understand.

bug754.zip <http://maven.40175.n5.nabble.com/file/n5751355/bug754.zip>  

<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>bug754</groupId>
    <artifactId>bug754</artifactId>
    <version>1.0-SNAPSHOT</version>

    <build>
            <resources>
                    <resource>
                            <directory>src/main/resources</directory>
                            <targetPath/>
                    </resource>
            </resources>
    </build>
</project>




--
View this message in context: http://maven.40175.n5.nabble.com/targetPath-for-resource-behaves-differently-Windows-v-Linux-tp5751355.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message