You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gareth Powell <Ga...@bluefinger.com> on 2005/11/25 11:45:28 UTC

M2: Build error when building an individual module in a multi-module setup

Hi,

	I'm trying to use Maven2 for a new project I'm working on and so far I'm very impressed with it, but I have found a couple of problems. Problems that are probably down to user error and mis-configuration.

	First of these problems is that with the project setup in a multi-module configuration with the modules extending the parent project with the following:

	<parent>
        		<artifactId>avalon-reports</artifactId>
		<groupId>com.bf.avalon</groupId>
        		<version>1.0-SNAPSHOT</version>
        		<relativePath>../pom.xml</relativePath>
    	</parent>


	If I run the build from the top-level parent directory the build works fine and installs snapshots into my local repo. The problem comes when I try to run a single module build inside one of the module directories. I know from having checked the repo after the top-level build that all my newly created jars are in the correct place but for some reason the build of the single module, refuses to resolve my inter module dependencies, as though it's ignoring my local repo. I also know that the dependencies are setup correctly as the top-level build works fine. The error I get is as follows:

	[INFO] ----------------------------------------------------------------------------
	[ERROR] BUILD ERROR
	[INFO] ----------------------------------------------------------------------------
	[INFO] Failed to resolve artifact.

	GroupId: com.bf.avalon
	ArtifactId: avalon-reports
	Version: 1.0-SNAPSHOT

	Reason: Unable to download the artifact from any repository
	  com.bf.avalon:avalon-reports:1.0-SNAPSHOT:pom

	from the specified remote repositories:
	  central (http://repo1.maven.org/maven2),
	  m2local (file:///mnt/m2)

	N.B. m2local is our shared releases repository and not my actual local repo which is /home/gpowell/.m2/repository.

	I don't want to have to run a top-level build everytime as this will be considerably slower, particularly when I'm working on a small module.  I am at a loss as to what I am doing wrong and any suggestions would be very much appreciated.

	The other issue, and this may be related to the above, is that I have installed a number of third party jars into my local repo and all of which are concrete releases (not SNAPHOTS). When I run a build Maven attempts to resolve the dependency by looking at http://repo1.maven.org/maven2, where these jars don't exist. It would appear that it is trying to find the pom for the third party jars, and none of them actually have a pom. Now as my dependencies are not SNAPSHOTs and they exist in my local repo, why does Maven waste time looking at the remote repo as this takes quite a bit of time when you have a lot of dependencies, thus slowing down the build considerably.  Other areas of Maven 2 seem to have been improved with regards to speed and performance so again I assume I am missing something.

Any pointers or suggestions would be very much appreciated.

Gareth

Gareth Powell
Software Engineer
Skype: gareth_powell_bf <callto:gareth_powell_bf> 
Tel: +44 (0) 1749 834994
email: gareth.powell@bluefinger.com 
BlueFinger Limited
Underwood Business Park
Wookey Hole Road, WELLS. BA5 1AF
Tel: +44 (0) 1749 834900
Fax: +44 (0) 1749 834901
web: www.bluefinger.com 
Company Reg No: 4209395 Registered Office: Underwood Business Park, Wookey Hole Road, Wells, Somerset BA5 1AF. 
*** This E-mail contains confidential information for the addressee only. If you are not the intended recipient, please notify us immediately. You should not use, disclose, distribute or copy this communication if received in error. No binding contract will result from this e-mail until such time as a written document is signed on behalf of the company. BlueFinger Limited cannot accept responsibility for the completeness or accuracy of this message as it has been transmitted over public networks.***





Re: M2: Build error when building an individual module in a multi-module setup

Posted by Lee Meador <le...@gmail.com>.
Warning: This method may not be a long term solution but works today for me.

To get rid of the slow-down when there is no POM in your local repository I
did the following.

1) Create a default/do-nothing POM for the jars. Here is the one for my
Websphere 6.0.0 j2ee.jar.

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.ibm.websphere</groupId>
  <artifactId>j2ee</artifactId>
  <version>6.0.0</version>
</project>

2) Put it in some temp folder somewhere on your computer.

3) install it into your local repository with almost the same command you
used to install the jar. Change the package from "jar" to "pom" and supply
the path to the POM file created in steps 1 and 2. (The first command
installs the jar. The second one installs the POM.)

mvn install:install-file -DgroupId=com.ibm.websphere \
 -DartifactId=j2ee -Dversion=6.0.0 \
 -Dpackaging=jar -Dfile=<path-to-websphere>/lib/j2ee.jar

mvn install:install-file -DgroupId=com.ibm.websphere \
 -DartifactId=j2ee -Dversion=6.0.0 \
 -Dpackaging=pom -Dfile=/temp/j2ee.pom


Thats it.

I don't think this is a permanent solution. Someone else may have a better
way to do this.

-- Lee Meador

On 11/25/05, Gareth Powell <Ga...@bluefinger.com> wrote:
>
> Hi,
>
>         I'm trying to use Maven2 for a new project I'm working on and so
> far I'm very impressed with it, but I have found a couple of problems.
> Problems that are probably down to user error and mis-configuration.
>
>         First of these problems is that with the project setup in a
> multi-module configuration with the modules extending the parent project
> with the following:
>
>         <parent>
>                         <artifactId>avalon-reports</artifactId>
>                 <groupId>com.bf.avalon</groupId>
>                         <version>1.0-SNAPSHOT</version>
>                         <relativePath>../pom.xml</relativePath>
>         </parent>
>
>
>         If I run the build from the top-level parent directory the build
> works fine and installs snapshots into my local repo. The problem comes when
> I try to run a single module build inside one of the module directories. I
> know from having checked the repo after the top-level build that all my
> newly created jars are in the correct place but for some reason the build of
> the single module, refuses to resolve my inter module dependencies, as
> though it's ignoring my local repo. I also know that the dependencies are
> setup correctly as the top-level build works fine. The error I get is as
> follows:
>
>         [INFO]
> ----------------------------------------------------------------------------
>         [ERROR] BUILD ERROR
>         [INFO]
> ----------------------------------------------------------------------------
>         [INFO] Failed to resolve artifact.
>
>         GroupId: com.bf.avalon
>         ArtifactId: avalon-reports
>         Version: 1.0-SNAPSHOT
>
>         Reason: Unable to download the artifact from any repository
>           com.bf.avalon:avalon-reports:1.0-SNAPSHOT:pom
>
>         from the specified remote repositories:
>           central (http://repo1.maven.org/maven2),
>           m2local (file:///mnt/m2)
>
>         N.B. m2local is our shared releases repository and not my actual
> local repo which is /home/gpowell/.m2/repository.
>
>         I don't want to have to run a top-level build everytime as this
> will be considerably slower, particularly when I'm working on a small
> module.  I am at a loss as to what I am doing wrong and any suggestions
> would be very much appreciated.
>
>         The other issue, and this may be related to the above, is that I
> have installed a number of third party jars into my local repo and all of
> which are concrete releases (not SNAPHOTS). When I run a build Maven
> attempts to resolve the dependency by looking at
> http://repo1.maven.org/maven2, where these jars don't exist. It would
> appear that it is trying to find the pom for the third party jars, and none
> of them actually have a pom. Now as my dependencies are not SNAPSHOTs and
> they exist in my local repo, why does Maven waste time looking at the remote
> repo as this takes quite a bit of time when you have a lot of dependencies,
> thus slowing down the build considerably.  Other areas of Maven 2 seem to
> have been improved with regards to speed and performance so again I assume I
> am missing something.
>
> Any pointers or suggestions would be very much appreciated.
>
> Gareth
>
> Gareth Powell
> Software Engineer
> Skype: gareth_powell_bf <callto:gareth_powell_bf>
> Tel: +44 (0) 1749 834994
> email: gareth.powell@bluefinger.com
> BlueFinger Limited
> Underwood Business Park
> Wookey Hole Road, WELLS. BA5 1AF
> Tel: +44 (0) 1749 834900
> Fax: +44 (0) 1749 834901
> web: www.bluefinger.com
> Company Reg No: 4209395 Registered Office: Underwood Business Park, Wookey
> Hole Road, Wells, Somerset BA5 1AF.
> *** This E-mail contains confidential information for the addressee only.
> If you are not the intended recipient, please notify us immediately. You
> should not use, disclose, distribute or copy this communication if received
> in error. No binding contract will result from this e-mail until such time
> as a written document is signed on behalf of the company. BlueFinger Limited
> cannot accept responsibility for the completeness or accuracy of this
> message as it has been transmitted over public networks.***
>
>
>
>
>
>


--
-- Lee Meador
Sent from gmail. My real email address is lee@leemeador.com