maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Scholte (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (MNG-6661) Override project.build.directory via user property
Date Tue, 28 May 2019 06:41:00 GMT

    [ https://issues.apache.org/jira/browse/MNG-6661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16849223#comment-16849223
] 

Robert Scholte edited comment on MNG-6661 at 5/28/19 6:40 AM:
--------------------------------------------------------------

All properties that start with $\{project. are readonly/immutable by design; you could say
it reflects the xpath of the pom.xml.

None of these will ever be settable via commandline or property. 

So as you already discovered you should be using <build><directory> to solve this,
all maven-plugins will understand this, i.e.

{code:xml}
    <profile>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <id>ramDisk</id>
      <build>
        <directory>/mnt/ramdisk/${project.groupId}/${project.artifactId}/target</directory>
      </build>
    </profile>
{code}


was (Author: rfscholte):
All properties that start with $\{project. are readonly/immutable by design; you could say
it reflects the xpath of the pom.xml.

None of these will ever be settable via commandline or property. 

So as you already discovered you should be using <build><directory> to solve this,
all maven-plugins will understand this.

> Override project.build.directory via user property
> --------------------------------------------------
>
>                 Key: MNG-6661
>                 URL: https://issues.apache.org/jira/browse/MNG-6661
>             Project: Maven
>          Issue Type: Improvement
>          Components: core
>            Reporter: Sergey Ponomarev
>            Assignee: Robert Scholte
>            Priority: Minor
>
> I would like to improve a build speed of a big project. The project uses a lot of IO
operation during a build. So I decided to put all /target directories into RAM disk while
keeping sources on a hard drive.
> I mounted a RAM disk to /mnt/ramdisk and created a profile:
> {code:xml}
>     <profile>
>       <activation>
>         <activeByDefault>true</activeByDefault>
>       </activation>
>       <id>ramDisk</id>
>       <properties>
>        <project.build.directory>/mnt/ramdisk/${project.groupId}/${project.artifactId}/target</project.build.directory>
>       </properties>
>     </profile>
> {code}
> In fact this is an equivalent of specifying -Dproject.build.directory
> But unfortunately this doesn't work because the property here (i.e. "user property")
is ignored.
> To make it working I should add into pom.xml this:
> {code}
>   <build>
>     <directory>${project.build.directory}</directory>
> {code}
> I.e. explicitly reuse the user property project.build.directory as configuration.
> Don't be confused, we can call the user property anyhow e.g. ${ram_dir} but I just wan't
to reuse existing property.
> I found a ticket that looks similar https://issues.apache.org/jira/browse/MNG-2598 but
this is another story.
> So could we implement this?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message