Hi! On Wednesday 20 October 2010 Hilco Wijbenga wrote: > On 11 October 2010 21:48, Hilco Wijbenga <[email protected]> wrote: > > I could have sworn I've used ${localRepository} before but it doesn't > > seem to work. I've also tried ${settings.localRepository} and > > ${maven.repo.local}. How do I refer to the location of the local > > repository in a portable way? Is there a difference between Maven2 and > > Maven3? > > I had a look in the source code and found the following: > [...] > Is there some documentation on how properties are handled internally? > How *does* project.build.directory get its value? > > Example 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/xsd/maven-4.0.0.xsd" > > <modelVersion>4.0.0</modelVersion> > <groupId>org.example</groupId> > <artifactId>maven-local-repo</artifactId> > <packaging>jar</packaging> > <version>0.1-SNAPSHOT</version> > <name>${x} - {y}</name> > <properties> > <x>${maven.local.repo}</x> > <y>${project.build.directory}</y> > </properties> > <build> > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-antrun-plugin</artifactId> > <version>1.6</version> > <executions> > <execution> > <phase>clean</phase> > <goals> > <goal>run</goal> > </goals> > <configuration> > <target> > <echo>${x}</echo> > <echo>${y}</echo> > </target> > </configuration> > </execution> > </executions> > </plugin> > </plugins> > </build> > </project> > > Simply run mvn clean.
I don't know what is actually the prefered way of accessing the path to the
local repository (but I'm quite sure I saw discussions about it on this
list before). However, running your example pom.xml works as soon as I
changed ${maven.local.repo} to ${settings.localRepository}. This is working
with maven 2.2.1 and maven 3.0-beta-3.
hth,
- martin
signature.asc
Description: This is a digitally signed message part.
