You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by M Muthukumaran <MM...@yodlee.com> on 2010/04/12 15:29:15 UTC

Multi Module and DistributionManagement

All,

 

I have a multi module project where I have only two modules. Every thing
works fine like build, install, etc. However I have problem while
deploying the artifact into my snapshot repository. I'm hosting
artifactory as my organization repository and every thing is perfect
from the repository configuration point of view. I have the profile
which is not active by default but activating through command line.
Please refer the parent POM below,

 

<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">

  

  <!-- Note: The model version is a constant. It needs to be same in

  all the POM.

  -->

  <modelVersion>4.0.0</modelVersion>

  

  <groupId>mygroup</groupId>

  <artifactId>myartifact</artifactId>

  <version>${version}</version>  

  <packaging>pom</packaging>

 

<modules>

    <module>module-A</module>

    <module>module-B</module>

</modules>

 

<profiles>

    <profile>

      <id>deploy-snapshot</id>

      <activation>

        <activeByDefault>false</activeByDefault>

      </activation>

      <distributionManagement>

        <snapshotRepository>

          <id>my-snapshot</id>

          <name>my-snapshot</name>

          <url>http://.......</url>

        </snapshotRepository>

      </distributionManagement>

    </profile>

  </profiles>

</project>

 

The problem is I need to go to each child POM and say my parent
(Inheritance) in order to have a successful artifact deployment into my
repository. 

 

Is this is known behavior or I'm doing something wrong... I do not want
to do both association and inheritance in my maven scripts. Could some
one please hint me to avoid this? 

 

I'm get the following problem when I don't have inheritance relationship
defined in the child POM's,

 

[INFO]
------------------------------------------------------------------------

[ERROR] BUILD ERROR

[INFO]
------------------------------------------------------------------------

[INFO] Failed to configure plugin parameters for:
org.apache.maven.plugins:maven-deploy-plugin:2.4

 

check that the following section of the pom.xml is present and correct:

 

<distributionManagement>

  <!-- use the following if you're not using a snapshot version. -->

  <repository>

    <id>repo</id>

    <name>Repository Name</name>

    <url>scp://host/path/to/repo</url>

  </repository>

  <!-- use the following if you ARE using a snapshot version. -->

  <snapshotRepository>

    <id>repo</id>

    <name>Repository Name</name>

    <url>scp://host/path/to/repo</url>

  </snapshotRepository>

</distributionManagement>

 

Cause: Class 'org.apache.maven.artifact.repository.ArtifactRepository'
cannot be instantiated

 

Thanks,

Muthu


RE: Multi Module and DistributionManagement

Posted by M Muthukumaran <MM...@yodlee.com>.
Ok. So I think inheritance is the only way for me.

I thought maven can read information about effective POM from module
declaration. It can in turn use that to deploy my artifacts into the
repository.

Yes. I'm planning to have multiple snapshot repositories for each
department in our organization. Do you see any issues with this
approach?

Thanks, 
Muthu

-----Original Message-----
From: Justin Edelson [mailto:justinedelson@gmail.com] 
Sent: Monday, April 12, 2010 8:03 PM
To: Maven Developers List
Subject: Re: Multi Module and DistributionManagement

On 4/12/10 9:29 AM, M Muthukumaran wrote:
> All,
> 
>  
> 
> I have a multi module project where I have only two modules. Every
thing
> works fine like build, install, etc. However I have problem while
> deploying the artifact into my snapshot repository. I'm hosting
> artifactory as my organization repository and every thing is perfect
> from the repository configuration point of view. I have the profile
> which is not active by default but activating through command line.
> Please refer the parent POM below,
> 
>  
> 
> <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">
> 
>   
> 
>   <!-- Note: The model version is a constant. It needs to be same in
> 
>   all the POM.
> 
>   -->
> 
>   <modelVersion>4.0.0</modelVersion>
> 
>   
> 
>   <groupId>mygroup</groupId>
> 
>   <artifactId>myartifact</artifactId>
> 
>   <version>${version}</version>  
> 
>   <packaging>pom</packaging>
> 
>  
> 
> <modules>
> 
>     <module>module-A</module>
> 
>     <module>module-B</module>
> 
> </modules>
> 
>  
> 
> <profiles>
> 
>     <profile>
> 
>       <id>deploy-snapshot</id>
> 
>       <activation>
> 
>         <activeByDefault>false</activeByDefault>
> 
>       </activation>
> 
>       <distributionManagement>
> 
>         <snapshotRepository>
> 
>           <id>my-snapshot</id>
> 
>           <name>my-snapshot</name>
> 
>           <url>http://.......</url>
> 
>         </snapshotRepository>
> 
>       </distributionManagement>
> 
>     </profile>
> 
>   </profiles>
> 
> </project>
> 
>  
> 
> The problem is I need to go to each child POM and say my parent
> (Inheritance) in order to have a successful artifact deployment into
my
> repository. 

How is this a problem? You would prefer Maven read your mind to
determine your snapshot repository?

> Is this is known behavior or I'm doing something wrong...
I'd say it's a known behavior that Maven builds the effective pom based
on information it is provided; not ESP.

> I do not want
> to do both association and inheritance in my maven scripts. Could some
> one please hint me to avoid this? 
Inheritance is, IMHO, unavoidable in any non-trivial Maven project.

BTW, why are you putting the snapshot repository in a profile? Are you
using multiple snapshot repositories? That seems odd to me.

Justin

> 
>  
> 
> I'm get the following problem when I don't have inheritance
relationship
> defined in the child POM's,
> 
>  
> 
> [INFO]
>
------------------------------------------------------------------------
> 
> [ERROR] BUILD ERROR
> 
> [INFO]
>
------------------------------------------------------------------------
> 
> [INFO] Failed to configure plugin parameters for:
> org.apache.maven.plugins:maven-deploy-plugin:2.4
> 
>  
> 
> check that the following section of the pom.xml is present and
correct:
> 
>  
> 
> <distributionManagement>
> 
>   <!-- use the following if you're not using a snapshot version. -->
> 
>   <repository>
> 
>     <id>repo</id>
> 
>     <name>Repository Name</name>
> 
>     <url>scp://host/path/to/repo</url>
> 
>   </repository>
> 
>   <!-- use the following if you ARE using a snapshot version. -->
> 
>   <snapshotRepository>
> 
>     <id>repo</id>
> 
>     <name>Repository Name</name>
> 
>     <url>scp://host/path/to/repo</url>
> 
>   </snapshotRepository>
> 
> </distributionManagement>
> 
>  
> 
> Cause: Class 'org.apache.maven.artifact.repository.ArtifactRepository'
> cannot be instantiated
> 
>  
> 
> Thanks,
> 
> Muthu
> 
> 


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


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


Re: Multi Module and DistributionManagement

Posted by Justin Edelson <ju...@gmail.com>.
On 4/12/10 9:29 AM, M Muthukumaran wrote:
> All,
> 
>  
> 
> I have a multi module project where I have only two modules. Every thing
> works fine like build, install, etc. However I have problem while
> deploying the artifact into my snapshot repository. I'm hosting
> artifactory as my organization repository and every thing is perfect
> from the repository configuration point of view. I have the profile
> which is not active by default but activating through command line.
> Please refer the parent POM below,
> 
>  
> 
> <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">
> 
>   
> 
>   <!-- Note: The model version is a constant. It needs to be same in
> 
>   all the POM.
> 
>   -->
> 
>   <modelVersion>4.0.0</modelVersion>
> 
>   
> 
>   <groupId>mygroup</groupId>
> 
>   <artifactId>myartifact</artifactId>
> 
>   <version>${version}</version>  
> 
>   <packaging>pom</packaging>
> 
>  
> 
> <modules>
> 
>     <module>module-A</module>
> 
>     <module>module-B</module>
> 
> </modules>
> 
>  
> 
> <profiles>
> 
>     <profile>
> 
>       <id>deploy-snapshot</id>
> 
>       <activation>
> 
>         <activeByDefault>false</activeByDefault>
> 
>       </activation>
> 
>       <distributionManagement>
> 
>         <snapshotRepository>
> 
>           <id>my-snapshot</id>
> 
>           <name>my-snapshot</name>
> 
>           <url>http://.......</url>
> 
>         </snapshotRepository>
> 
>       </distributionManagement>
> 
>     </profile>
> 
>   </profiles>
> 
> </project>
> 
>  
> 
> The problem is I need to go to each child POM and say my parent
> (Inheritance) in order to have a successful artifact deployment into my
> repository. 

How is this a problem? You would prefer Maven read your mind to
determine your snapshot repository?

> Is this is known behavior or I'm doing something wrong...
I'd say it's a known behavior that Maven builds the effective pom based
on information it is provided; not ESP.

> I do not want
> to do both association and inheritance in my maven scripts. Could some
> one please hint me to avoid this? 
Inheritance is, IMHO, unavoidable in any non-trivial Maven project.

BTW, why are you putting the snapshot repository in a profile? Are you
using multiple snapshot repositories? That seems odd to me.

Justin

> 
>  
> 
> I'm get the following problem when I don't have inheritance relationship
> defined in the child POM's,
> 
>  
> 
> [INFO]
> ------------------------------------------------------------------------
> 
> [ERROR] BUILD ERROR
> 
> [INFO]
> ------------------------------------------------------------------------
> 
> [INFO] Failed to configure plugin parameters for:
> org.apache.maven.plugins:maven-deploy-plugin:2.4
> 
>  
> 
> check that the following section of the pom.xml is present and correct:
> 
>  
> 
> <distributionManagement>
> 
>   <!-- use the following if you're not using a snapshot version. -->
> 
>   <repository>
> 
>     <id>repo</id>
> 
>     <name>Repository Name</name>
> 
>     <url>scp://host/path/to/repo</url>
> 
>   </repository>
> 
>   <!-- use the following if you ARE using a snapshot version. -->
> 
>   <snapshotRepository>
> 
>     <id>repo</id>
> 
>     <name>Repository Name</name>
> 
>     <url>scp://host/path/to/repo</url>
> 
>   </snapshotRepository>
> 
> </distributionManagement>
> 
>  
> 
> Cause: Class 'org.apache.maven.artifact.repository.ArtifactRepository'
> cannot be instantiated
> 
>  
> 
> Thanks,
> 
> Muthu
> 
> 


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