You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "James C. McPherson" <ja...@gmail.com> on 2010/05/05 03:09:09 UTC

is this expected behaviour?

Greetings one-n-all,
I pulled down the maven 2.2.1 source so I could build it into
an OpenSolaris package, and then use it with a project that I'm
lurking on. I don't install tools like this to my homedir, because
I make sure that build tools are commonly available on my systems.



I install my own packages into /opt/local, so I ran
--------------------------------------------------------
blinder:apache-maven-2.2.1 $ M2_HOME=/opt/local MAVEN_OPTS=-o pfexec ant install
Buildfile: build.xml

BUILD FAILED
Target "install" does not exist in the project "null".
--------------------------------------------------------

which I found a little annoying, but then I re-ran ant with
the root role thinking that the ant script might do the installation
automatically for me:


--------------------------------------------------------
blinder:apache-maven-2.2.1 $ M2_HOME=/opt/local MAVEN_OPTS=-o pfexec ant
Buildfile: build.xml

clean-bootstrap:

initTaskDefs:

isMavenHomeSet:
      [echo] Using Maven home at: /opt/local

initLocalRepo:
      [echo] Using the local repository at: /root/.m2/repository

init:
      [echo] maven.home = /opt/local
      [echo] maven.assembly = /scratch/src/build/apache-maven-2.2.1/apache-maven/target/apache-maven-2.2.1-bin.zip

[SNIP]

      [java] [INFO]
      [java] [INFO]
      [java] [INFO] ------------------------------------------------------------------------
      [java] [INFO] Reactor Summary:
      [java] [INFO] ------------------------------------------------------------------------
      [java] [INFO] Maven ................................................. SUCCESS [13:47.922s]
      [java] [INFO] Maven Artifact ........................................ SUCCESS [2:13.155s]
      [java] [INFO] Maven Repository Metadata Model ....................... SUCCESS [1:12.825s]
      [java] [INFO] Maven Artifact Manager ................................ SUCCESS [57.793s]
      [java] [INFO] Maven Model ........................................... SUCCESS [12.989s]
      [java] [INFO] Maven Local Settings Model ............................ SUCCESS [2.079s]
      [java] [INFO] Maven Artifact Test Helper Library .................... SUCCESS [0.843s]
      [java] [INFO] Maven Plugin Parameter Documenter API ................. SUCCESS [1.628s]
      [java] [INFO] Maven Reporting ....................................... SUCCESS [0.077s]
      [java] [INFO] Maven Reporting API ................................... SUCCESS [0.847s]
      [java] [INFO] Maven Profile Model ................................... SUCCESS [1.739s]
      [java] [INFO] Maven Error Diagnostics ............................... SUCCESS [0.841s]
      [java] [INFO] Maven Plugin Registry Model ........................... SUCCESS [1.123s]
      [java] [INFO] Maven Project Builder ................................. SUCCESS [7.684s]
      [java] [INFO] Maven Plugin API ...................................... SUCCESS [0.852s]
      [java] [INFO] Maven Plugin Descriptor Model ......................... SUCCESS [1.785s]
      [java] [INFO] Maven Monitor ......................................... SUCCESS [0.938s]
      [java] [INFO] Maven Core ............................................ SUCCESS [2:50.926s]
      [java] [INFO] Maven Compatibility Layer ............................. SUCCESS [1.117s]
      [java] [INFO] Maven Script Support Root ............................. SUCCESS [0.116s]
      [java] [INFO] Maven Ant Mojo Support ................................ SUCCESS [4:21.376s]
      [java] [INFO] Maven Beanshell Mojo Support .......................... SUCCESS [46.264s]
      [java] [INFO] Maven Toolchains ...................................... SUCCESS [46.279s]
      [java] [INFO] Maven Distribution .................................... SUCCESS [4:27.414s]
      [java] [INFO] ------------------------------------------------------------------------
      [java] [INFO] ------------------------------------------------------------------------
      [java] [INFO] BUILD SUCCESSFUL
      [java] [INFO] ------------------------------------------------------------------------
      [java] [INFO] Total time: 32 minutes
      [java] [INFO] Finished at: Tue May 04 21:39:50 EST 2010
      [java] [INFO] Final Memory: 84M/202M
      [java] [INFO] ------------------------------------------------------------------------

maven-assembly:
      [echo]
      [echo]     The new Maven distribution was created as part of the MAVEN-COMPILE step, above.
      [echo]     This goal just validates the presence of that distribution.
      [echo]


extract-assembly:
      [echo] Extracting assembly to /opt ...
    [delete] Deleting directory /opt/local

BUILD FAILED
/scratch/src/build/apache-maven-2.2.1/build.xml:221: Unable to delete directory /opt/local

Total time: 49 minutes 9 seconds
blinder:apache-maven-2.2.1 $ ls /opt/local
total 0

--------------------------------------------------------



This, y'see, is a problem. Is this rmdir stage something that
ant does, or maven?

Why on *earth* does this happen anyway?

I didn't see any indication that this would happen when I reviewed
http://maven.apache.org/guides/development/guide-building-m2.html.


What part did I miss, and what can I do to fix it?


thankyou in advance,  
James C. McPherson
--
Solaris kernel software engineer, system admin and troubleshooter
               http://www.jmcp.homeunix.com/blog
Find me on LinkedIn @ http://www.linkedin.com/in/jamescmcpherson


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


Re: is this expected behaviour?

Posted by Benjamin Bentmann <be...@udo.edu>.
Brett Porter wrote:

> It used to check the env var was correct before starting - I'm not sure why it didn't in this case.

In case you refer to MNG-4352, that was applied after 2.2.1 was released.


Benjamin

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


Re: is this expected behaviour?

Posted by "James C. McPherson" <ja...@gmail.com>.
On  5/05/10 11:56 AM, Brett Porter wrote:
> You should set M2_HOME to /opt/local/apache-maven-2.2.1.
>
> It used to check the env var was correct before starting - I'm not sure why it didn't in this case.

Thanks Brett, I'll give that a whirl.

To assuage my curiosity, could you clue me in on why
M2_HOME must be named that way? The way we generally
name package dirs on OpenSolaris is

/prefix/product/version/[installed bits]

So ideally I'd like to be able to use

/opt/local/apache-maven/2.2.1
or
/opt/local/maven/2.2.1


Thanks again,
James C. McPherson
--
Solaris kernel software engineer, system admin and troubleshooter
               http://www.jmcp.homeunix.com/blog
Find me on LinkedIn @ http://www.linkedin.com/in/jamescmcpherson


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


Re: is this expected behaviour?

Posted by Brett Porter <br...@apache.org>.
You should set M2_HOME to /opt/local/apache-maven-2.2.1.

It used to check the env var was correct before starting - I'm not sure why it didn't in this case.

On 05/05/2010, at 11:09 AM, James C. McPherson wrote:

> 
> Greetings one-n-all,
> I pulled down the maven 2.2.1 source so I could build it into
> an OpenSolaris package, and then use it with a project that I'm
> lurking on. I don't install tools like this to my homedir, because
> I make sure that build tools are commonly available on my systems.
> 
> 
> 
> I install my own packages into /opt/local, so I ran
> --------------------------------------------------------
> blinder:apache-maven-2.2.1 $ M2_HOME=/opt/local MAVEN_OPTS=-o pfexec ant install
> Buildfile: build.xml
> 
> BUILD FAILED
> Target "install" does not exist in the project "null".
> --------------------------------------------------------
> 
> which I found a little annoying, but then I re-ran ant with
> the root role thinking that the ant script might do the installation
> automatically for me:
> 
> 
> --------------------------------------------------------
> blinder:apache-maven-2.2.1 $ M2_HOME=/opt/local MAVEN_OPTS=-o pfexec ant
> Buildfile: build.xml
> 
> clean-bootstrap:
> 
> initTaskDefs:
> 
> isMavenHomeSet:
>     [echo] Using Maven home at: /opt/local
> 
> initLocalRepo:
>     [echo] Using the local repository at: /root/.m2/repository
> 
> init:
>     [echo] maven.home = /opt/local
>     [echo] maven.assembly = /scratch/src/build/apache-maven-2.2.1/apache-maven/target/apache-maven-2.2.1-bin.zip
> 
> [SNIP]
> 
>     [java] [INFO]
>     [java] [INFO]
>     [java] [INFO] ------------------------------------------------------------------------
>     [java] [INFO] Reactor Summary:
>     [java] [INFO] ------------------------------------------------------------------------
>     [java] [INFO] Maven ................................................. SUCCESS [13:47.922s]
>     [java] [INFO] Maven Artifact ........................................ SUCCESS [2:13.155s]
>     [java] [INFO] Maven Repository Metadata Model ....................... SUCCESS [1:12.825s]
>     [java] [INFO] Maven Artifact Manager ................................ SUCCESS [57.793s]
>     [java] [INFO] Maven Model ........................................... SUCCESS [12.989s]
>     [java] [INFO] Maven Local Settings Model ............................ SUCCESS [2.079s]
>     [java] [INFO] Maven Artifact Test Helper Library .................... SUCCESS [0.843s]
>     [java] [INFO] Maven Plugin Parameter Documenter API ................. SUCCESS [1.628s]
>     [java] [INFO] Maven Reporting ....................................... SUCCESS [0.077s]
>     [java] [INFO] Maven Reporting API ................................... SUCCESS [0.847s]
>     [java] [INFO] Maven Profile Model ................................... SUCCESS [1.739s]
>     [java] [INFO] Maven Error Diagnostics ............................... SUCCESS [0.841s]
>     [java] [INFO] Maven Plugin Registry Model ........................... SUCCESS [1.123s]
>     [java] [INFO] Maven Project Builder ................................. SUCCESS [7.684s]
>     [java] [INFO] Maven Plugin API ...................................... SUCCESS [0.852s]
>     [java] [INFO] Maven Plugin Descriptor Model ......................... SUCCESS [1.785s]
>     [java] [INFO] Maven Monitor ......................................... SUCCESS [0.938s]
>     [java] [INFO] Maven Core ............................................ SUCCESS [2:50.926s]
>     [java] [INFO] Maven Compatibility Layer ............................. SUCCESS [1.117s]
>     [java] [INFO] Maven Script Support Root ............................. SUCCESS [0.116s]
>     [java] [INFO] Maven Ant Mojo Support ................................ SUCCESS [4:21.376s]
>     [java] [INFO] Maven Beanshell Mojo Support .......................... SUCCESS [46.264s]
>     [java] [INFO] Maven Toolchains ...................................... SUCCESS [46.279s]
>     [java] [INFO] Maven Distribution .................................... SUCCESS [4:27.414s]
>     [java] [INFO] ------------------------------------------------------------------------
>     [java] [INFO] ------------------------------------------------------------------------
>     [java] [INFO] BUILD SUCCESSFUL
>     [java] [INFO] ------------------------------------------------------------------------
>     [java] [INFO] Total time: 32 minutes
>     [java] [INFO] Finished at: Tue May 04 21:39:50 EST 2010
>     [java] [INFO] Final Memory: 84M/202M
>     [java] [INFO] ------------------------------------------------------------------------
> 
> maven-assembly:
>     [echo]
>     [echo]     The new Maven distribution was created as part of the MAVEN-COMPILE step, above.
>     [echo]     This goal just validates the presence of that distribution.
>     [echo]
> 
> 
> extract-assembly:
>     [echo] Extracting assembly to /opt ...
>   [delete] Deleting directory /opt/local
> 
> BUILD FAILED
> /scratch/src/build/apache-maven-2.2.1/build.xml:221: Unable to delete directory /opt/local
> 
> Total time: 49 minutes 9 seconds
> blinder:apache-maven-2.2.1 $ ls /opt/local
> total 0
> 
> --------------------------------------------------------
> 
> 
> 
> This, y'see, is a problem. Is this rmdir stage something that
> ant does, or maven?
> 
> Why on *earth* does this happen anyway?
> 
> I didn't see any indication that this would happen when I reviewed
> http://maven.apache.org/guides/development/guide-building-m2.html.
> 
> 
> What part did I miss, and what can I do to fix it?
> 
> 
> thankyou in advance,  James C. McPherson
> --
> Solaris kernel software engineer, system admin and troubleshooter
>              http://www.jmcp.homeunix.com/blog
> Find me on LinkedIn @ http://www.linkedin.com/in/jamescmcpherson
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/





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


Re: is this expected behaviour?

Posted by "James C. McPherson" <ja...@gmail.com>.
On  5/05/10 10:00 PM, Benjamin Bentmann wrote:
> James C. McPherson wrote:
>
>> I think it's reasonable to remove the
>>
>> <delete dir="${maven.home}"/>
>>
>> from the extract-assembly target. Thoughts?
>
> No, this task should stay in place as it ensures the installation
> directory actually contains the just built distribution and not some
> remains from a previous build. So I'm for "Not a bug" regarding MNG-4663
> in its current form.  
> What could however be changed/discussed is the semantics of the
> maven.home directory being specified to the script. While one is
> supposed to enter something like
> /opt/local/apache-maven-<version>
> the script effectively ignores the last directory part but uses the root
> directory from the distro. I think using a file mapper for the <unzip>
> task one could chop off the archive's root directory. This would allow
> users to specify
> /opt/local/apache-maven/2.2.1
> or whathever they like as home directory.
>
> Thoughts?

What I'm used to in this area is having a "clobber" or "clean"
target, which you can call (but which is not mandatory to call)
before running an "install" target.

I'm not really keen to have install depend on clobber.


That said, if there was a warning uttered along the lines of


Apache Maven v..... will be installed to /path/to/unpacked/bits
Any existing files and directories under /path/to/unpacked/bits
will be removed.
Do you want to continue? [Y/n]:



at the start of the ant build process, that would probably have
helped me avoid loss of files.


  
James
--
Solaris kernel software engineer, system admin and troubleshooter
               http://www.jmcp.homeunix.com/blog
Find me on LinkedIn @ http://www.linkedin.com/in/jamescmcpherson


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


Re: is this expected behaviour?

Posted by Benjamin Bentmann <be...@udo.edu>.
James C. McPherson wrote:

> I think it's reasonable to remove the
>
> <delete dir="${maven.home}"/>
>
> from the extract-assembly target. Thoughts?

No, this task should stay in place as it ensures the installation 
directory actually contains the just built distribution and not some 
remains from a previous build. So I'm for "Not a bug" regarding MNG-4663 
in its current form.

What could however be changed/discussed is the semantics of the 
maven.home directory being specified to the script. While one is 
supposed to enter something like
   /opt/local/apache-maven-<version>
the script effectively ignores the last directory part but uses the root 
directory from the distro. I think using a file mapper for the <unzip> 
task one could chop off the archive's root directory. This would allow 
users to specify
   /opt/local/apache-maven/2.2.1
or whathever they like as home directory.

Thoughts?


Benjamin

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


Re: is this expected behaviour?

Posted by "James C. McPherson" <ja...@gmail.com>.
On  5/05/10 12:16 PM, James C. McPherson wrote:
> On  5/05/10 12:00 PM, Martin Gainty wrote:
>> <!-- i specifically set M2_HOME in the build.xml located in M2_HOME
>> root-->
>> <property name="M2_HOME" value="/opt/local"/>
>>
>> <condition property="maven.home" value="${M2_HOME}">
>> <isset property="M2_HOME"/>
>> </condition>
>>
>> extract-assembly:
>> <delete dir="${maven.home}"/>
>> <mkdir dir="${maven.home}"/>
>>
>> Unable to delete directory /opt/local means
>> 1)the directory does not exist..so create it
>> 2)give yourself delete access to the folder usually chown of the folder
>> gives all perms for the folder to you e.g.
>>
>> cd /opt/local
>> $ chown mgainty .
>>
>> $ ls -al
>> total 0
>> drwxrwxrwx+ 2 mgainty mkpasswd 0 May 5 04:51 .
>> drwxr-xr-x+ 3 mgainty mkpasswd 0 May 5 04:51 ..
>
> Hi Martin,
> thankyou, but that directory already existed - and had a large
> amount of software in it that I've already packaged up. I really
> didn't want any bit of it deleted!
>
> Also, that directory (/opt/local) is actually a separate
> mountpoint - zfs dataset, to be precise.
>
>
> Now that you've pointed me to the relevant build.xml bits,
> I'm surprised that <delete><mkdir> are the process steps
> used to ensure maven.home is created.
>
> Does "mkdir -p" or its OS-specific equivalent not work somewhere?


Sorry to follow-up to myself - I just checked the ant task doco,
and the Mkdir task description says:

==========================
Creates a directory. Also non-existent parent directories are created,
when necessary. Does nothing if the directory already exist.
==========================

I think it's reasonable to remove the

<delete dir="${maven.home}"/>

from the extract-assembly target. Thoughts?


cheers,
James C. McPherson
--
Solaris kernel software engineer, system admin and troubleshooter
               http://www.jmcp.homeunix.com/blog
Find me on LinkedIn @ http://www.linkedin.com/in/jamescmcpherson


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