You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Hal Hildebrand <ha...@hellblazer.com> on 2007/01/22 18:23:55 UTC

[maven 2] assembly: repository from multiple modules

I have a large, multiple module project that I need to create a repository
assembly for.  I have no problems creating the binary, including the
dependencies. However, I can't seem to create a repository.  I'm running the
assembly in the project's top level pom, of course, but from what I can
tell, there seems to be no way to indicated to use all the sub modules -
i.e. The only way to create the repository seems to be be placing all the
dependencies in the top level pom.  Obviously, this will be a nightmare to
maintain.  Also, since the binary assembly seems perfectly capable of
including the sub module's binaries and dependencies, it would seem that the
repository assembly should be able to do the same.

Falling short of actually creating the repository for one reason or another,
if I could get the format of the binary assembly to be identical to the
repository layout, that would be sufficient for my needs as I don't need the
maven repository metadata.  Right now, I've tried using no outputfile
format, with simply a directory - doesn't work.  I've also tried using:
${groupId}/${artifactId} as the directory - kind of works, but now I have
.'s instead of /'s in the repository group id directory.

Surely this is possible through some machination or incantation, right?



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


Re: [maven 2] assembly: repository from multiple modules

Posted by Dominic Mitchell <do...@semantico.com>.
On 15 May 2009, at 22:36, Brian Fox wrote:

> The dependency:copy-dependencies can also produce a repository layout.
> Surely some combination of that plus assembly to zip it up should  
> work.

It's a good start, but it's not complete.  For example, it doesn't  
include any plugins.

Ideally, something like dependency:go-offline, except that it saved  
everything to a known location instead of the local repository.

-Dom

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


RE: [maven 2] assembly: repository from multiple modules

Posted by Martin Gainty <mg...@hotmail.com>.
i found this link helpful
http://propellors.net/maven/book/assemblies.html

the maven site defines elements used in source node here
http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_moduleSources

repositories feature of assemblies would work for a multi-module project.
so we're on the same page what do you considered a module
also does multi-module have some defining characteristic?

here is an early discussion of Maven module from Brett Porter circa 2005
http://docs.codehaus.org/display/MAVEN/Improves+Modules+Definition
where the only definining characteristic is groupId,artifactId and version

Here is Glassfish definition of module
Module Definition
At high level, a module is defined by the following information.

key
description
example

name
Name of the component
com.sun.module

version
Version number of the module
1.2.1-rc4

imports
list of imported component, comma separated
com.sun.bar com.sun.myothermodule

exports
list of classes or packages exported
com.sun.module.spiwhere name is analogous to artifactId
and exports list is analogous to groupId

https://hk2.dev.java.net/modules.html

would wither of these definitions conform to your understanding of module ?
thanks,
Martin 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Sat, 16 May 2009 07:43:59 -0700
> From: DSMILEY@mitre.org
> To: users@maven.apache.org
> Subject: Re: [maven 2] assembly: repository from multiple modules
> 
> 
> Thanks Brian, this led me on the right path.  Still... it'd be nice if the
> repositories feature of assemblies would work for a multi-module project.
> 
> So I ended up with this in my parent pom:
> 
>             <plugin>
>                 <artifactId>maven-dependency-plugin</artifactId>
>                 <configuration>
>                     <copyPom>true</copyPom>
>                     <useRepositoryLayout>true</useRepositoryLayout>
>                 </configuration>
>             </plugin>
>             
>             <plugin>
>                 <artifactId>maven-assembly-plugin</artifactId>
>                 <version>2.2-beta-3</version>
>                 <configuration>
>                     <finalName>m2-repo</finalName>
>                     <appendAssemblyId>false</appendAssemblyId>
>                     <descriptors>
>                         <descriptor>src/maven-assembly-repo.xml</descriptor>
>                     </descriptors>
>                 </configuration>
>             </plugin>
> 
> and my maven-assembly-repo.xml descriptor looks like this:
> <assembly 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/assembly-1.0.0.xsd">
>     <id>repository</id>
>     <formats>
>         <format>zip</format>
>     </formats>
>     <includeBaseDirectory>false</includeBaseDirectory>
>     <moduleSets>
>         <moduleSet>
>             <sources>
>               <includeModuleDirectory>false</includeModuleDirectory>
>               <fileSets>
>                 <fileSet>
>                   <directory>target/dependency</directory>
>                 </fileSet>
>               </fileSets>
>             </sources>
>         </moduleSet>
>     </moduleSets>
> </assembly>
> 
> Thanks everyone for trying to help.  BTW... it DID occur to me to
> temporarily use an empty local repo and then zip it when I'm done with a
> build.  That would be pragmatic to get a solution quick but it felt a bit
> sloppy and I wanted a better solution.
> 
> ~ David Smiley
> 
> 
> BRIAN FOX-5 wrote:
> > 
> > The dependency:copy-dependencies can also produce a repository layout.
> > Surely some combination of that plus assembly to zip it up should work.
> > 
> > On Fri, May 15, 2009 at 3:39 PM, David Smiley @MITRE.org
> > <DS...@mitre.org>wrote:
> > 
> >>
> >> Any update to this?  I've tried a bunch of combinations.  I think at this
> >> point I'm going to try and hack the latest source to meet my needs.
> >>
> >> ~ David
> >>
> >>
> >> Hal Hildebrand-3 wrote:
> >> >
> >> > I have a large, multiple module project that I need to create a
> >> repository
> >> > assembly for.  I have no problems creating the binary, including the
> >> > dependencies. However, I can't seem to create a repository.  I'm
> >> running
> >> > the
> >> > assembly in the project's top level pom, of course, but from what I can
> >> > tell, there seems to be no way to indicated to use all the sub modules
> >> -
> >> > i.e. The only way to create the repository seems to be be placing all
> >> the
> >> > dependencies in the top level pom.  Obviously, this will be a nightmare
> >> to
> >> > maintain.  Also, since the binary assembly seems perfectly capable of
> >> > including the sub module's binaries and dependencies, it would seem
> >> that
> >> > the
> >> > repository assembly should be able to do the same.
> >> >
> >> > Falling short of actually creating the repository for one reason or
> >> > another,
> >> > if I could get the format of the binary assembly to be identical to the
> >> > repository layout, that would be sufficient for my needs as I don't
> >> need
> >> > the
> >> > maven repository metadata.  Right now, I've tried using no outputfile
> >> > format, with simply a directory - doesn't work.  I've also tried using:
> >> > ${groupId}/${artifactId} as the directory - kind of works, but now I
> >> have
> >> > .'s instead of /'s in the repository group id directory.
> >> >
> >> > Surely this is possible through some machination or incantation, right?
> >> >
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> > For additional commands, e-mail: users-help@maven.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/-maven-2--assembly%3A-repository-from-multiple-modules-tp8505848p23566098.html
> >> Sent from the Maven - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/-maven-2--assembly%3A-repository-from-multiple-modules-tp8505848p23574391.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

_________________________________________________________________
Hotmail® has a new way to see what's up with your friends.
http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM_Tutorial_WhatsNew1_052009

Re: [maven 2] assembly: repository from multiple modules

Posted by "David Smiley @MITRE.org" <DS...@mitre.org>.
Thanks Brian, this led me on the right path.  Still... it'd be nice if the
repositories feature of assemblies would work for a multi-module project.

So I ended up with this in my parent pom:

            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <configuration>
                    <copyPom>true</copyPom>
                    <useRepositoryLayout>true</useRepositoryLayout>
                </configuration>
            </plugin>
            
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2-beta-3</version>
                <configuration>
                    <finalName>m2-repo</finalName>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptors>
                        <descriptor>src/maven-assembly-repo.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>

and my maven-assembly-repo.xml descriptor looks like this:
<assembly 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/assembly-1.0.0.xsd">
    <id>repository</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <moduleSets>
        <moduleSet>
            <sources>
              <includeModuleDirectory>false</includeModuleDirectory>
              <fileSets>
                <fileSet>
                  <directory>target/dependency</directory>
                </fileSet>
              </fileSets>
            </sources>
        </moduleSet>
    </moduleSets>
</assembly>

Thanks everyone for trying to help.  BTW... it DID occur to me to
temporarily use an empty local repo and then zip it when I'm done with a
build.  That would be pragmatic to get a solution quick but it felt a bit
sloppy and I wanted a better solution.

~ David Smiley


BRIAN FOX-5 wrote:
> 
> The dependency:copy-dependencies can also produce a repository layout.
> Surely some combination of that plus assembly to zip it up should work.
> 
> On Fri, May 15, 2009 at 3:39 PM, David Smiley @MITRE.org
> <DS...@mitre.org>wrote:
> 
>>
>> Any update to this?  I've tried a bunch of combinations.  I think at this
>> point I'm going to try and hack the latest source to meet my needs.
>>
>> ~ David
>>
>>
>> Hal Hildebrand-3 wrote:
>> >
>> > I have a large, multiple module project that I need to create a
>> repository
>> > assembly for.  I have no problems creating the binary, including the
>> > dependencies. However, I can't seem to create a repository.  I'm
>> running
>> > the
>> > assembly in the project's top level pom, of course, but from what I can
>> > tell, there seems to be no way to indicated to use all the sub modules
>> -
>> > i.e. The only way to create the repository seems to be be placing all
>> the
>> > dependencies in the top level pom.  Obviously, this will be a nightmare
>> to
>> > maintain.  Also, since the binary assembly seems perfectly capable of
>> > including the sub module's binaries and dependencies, it would seem
>> that
>> > the
>> > repository assembly should be able to do the same.
>> >
>> > Falling short of actually creating the repository for one reason or
>> > another,
>> > if I could get the format of the binary assembly to be identical to the
>> > repository layout, that would be sufficient for my needs as I don't
>> need
>> > the
>> > maven repository metadata.  Right now, I've tried using no outputfile
>> > format, with simply a directory - doesn't work.  I've also tried using:
>> > ${groupId}/${artifactId} as the directory - kind of works, but now I
>> have
>> > .'s instead of /'s in the repository group id directory.
>> >
>> > Surely this is possible through some machination or incantation, right?
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-maven-2--assembly%3A-repository-from-multiple-modules-tp8505848p23566098.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/-maven-2--assembly%3A-repository-from-multiple-modules-tp8505848p23574391.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: [maven 2] assembly: repository from multiple modules

Posted by Brian Fox <br...@infinity.nu>.
The dependency:copy-dependencies can also produce a repository layout.
Surely some combination of that plus assembly to zip it up should work.

On Fri, May 15, 2009 at 3:39 PM, David Smiley @MITRE.org
<DS...@mitre.org>wrote:

>
> Any update to this?  I've tried a bunch of combinations.  I think at this
> point I'm going to try and hack the latest source to meet my needs.
>
> ~ David
>
>
> Hal Hildebrand-3 wrote:
> >
> > I have a large, multiple module project that I need to create a
> repository
> > assembly for.  I have no problems creating the binary, including the
> > dependencies. However, I can't seem to create a repository.  I'm running
> > the
> > assembly in the project's top level pom, of course, but from what I can
> > tell, there seems to be no way to indicated to use all the sub modules -
> > i.e. The only way to create the repository seems to be be placing all the
> > dependencies in the top level pom.  Obviously, this will be a nightmare
> to
> > maintain.  Also, since the binary assembly seems perfectly capable of
> > including the sub module's binaries and dependencies, it would seem that
> > the
> > repository assembly should be able to do the same.
> >
> > Falling short of actually creating the repository for one reason or
> > another,
> > if I could get the format of the binary assembly to be identical to the
> > repository layout, that would be sufficient for my needs as I don't need
> > the
> > maven repository metadata.  Right now, I've tried using no outputfile
> > format, with simply a directory - doesn't work.  I've also tried using:
> > ${groupId}/${artifactId} as the directory - kind of works, but now I have
> > .'s instead of /'s in the repository group id directory.
> >
> > Surely this is possible through some machination or incantation, right?
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/-maven-2--assembly%3A-repository-from-multiple-modules-tp8505848p23566098.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: [maven 2] assembly: repository from multiple modules

Posted by Martin Gainty <mg...@hotmail.com>.
you'll need to configure your new localRepository in $MAVEN_HOME/conf/settings.xml
  <!-- 
  localRepository
   | The path to the local repository maven will use to store artifacts.
   | Default: ~/.m2/repository
  <localRepository>/path/to/local/repo</localRepository/>
  -->
  <!-- localRepository>F:\Maven-plugin</localRepository -->

also config $MAVEN_HOME/conf/plugin-registry.xml to include the localRepostoryPath as defined 
<localRepositoryPath>F:\maven-plugin</localRepositoryPath>
<plugins>

then your pom.xml plugins should have localRepositoryPath defined in <configuration>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>1.2</version>
            <configuration>
              <projectsDirectory>src/it</projectsDirectory>
              <pomIncludes>
                <pomInclude>**/**/pom.xml</pomInclude>
              </pomIncludes>
              <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>

Here is a java TestCase class which will test the functionality
public class DefaultArtifactTest extends TestCase
{
    private DefaultArtifact artifact;
    private String groupId = "groupid", artifactId = "artifactId", version = "1.0", scope = "scope", type = "type",classifier = "classifier";
    private VersionRange versionRange;
    private ArtifactHandlerMock artifactHandler;
    protected void setUp() throws Exception
    {
        super.setUp();
        artifactHandler = new ArtifactHandlerMock();
        versionRange = VersionRange.createFromVersion( version );
//notice how the DefaultArtifact is created 
        artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, classifier, artifactHandler );
    }

    public void testToString()
    {
      assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier + ":" + version + ":" + scope,
      artifact.toString() );
    }
//TestString method is the most pertinent to your question on how to deliver the artifact name
//groupId + ":" + artifactId + ":" + type + ":" + classifier + ":" + version + ":" + //scope
    }
}

and the applicable package org.apache.maven.artifact.DefaultArtifact
    public DefaultArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, String type,String classifier, ArtifactHandler artifactHandler )
    {
        this( groupId, artifactId, versionRange, scope, type, classifier, artifactHandler, false );
    }

which calls to this giant mutator (same params as before but with optional)
public DefaultArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, String type,String classifier, ArtifactHandler artifactHandler, boolean optional )
 {
        this.groupId = groupId;
        this.artifactId = artifactId;
        this.versionRange = versionRange;       
        selectVersionFromNewRangeIfAvailable();
        this.artifactHandler = artifactHandler;
        this.scope = scope;
        this.type = type;
        if ( classifier == null )
        {
            classifier = artifactHandler.getClassifier();
        }
        this.classifier = classifier;
        this.optional = optional;
        validateIdentity();
}
//and of course the name delivered by toString() which you would modify
   public String toString() {
        StringBuffer sb = new StringBuffer();
        if ( getGroupId() != null ) {
            sb.append( getGroupId() );
            sb.append( ":" );
        }
        appendArtifactTypeClassifierString( sb );
        sb.append( ":" );
        if ( version != null || baseVersion != null ) {
            sb.append( getBaseVersion() );
        }
        else {
            sb.append( versionRange.toString() );
        }
        if ( scope != null ) {
            sb.append( ":" );
            sb.append( scope );
        }
        return sb.toString();
    }
//any changes made to directory should be accomodated here
    public void updateVersion( String version, DefaultArtifactRepository localRepository )
    {
        setResolvedVersion( version );
        setFile( new File( localRepository.getBasedir(), localRepository.pathOf( this ) ) );
    }

the second parameter uses DefaultArtifactRepository class defined here
public class DefaultArtifactRepository
    extends Repository
    implements ArtifactRepository
{
    private final ArtifactRepositoryLayout layout;

    private ArtifactRepositoryPolicy snapshots;

    private ArtifactRepositoryPolicy releases;

    private boolean uniqueVersion;

    private boolean blacklisted;

    /**
     * Create a local repository or a test repository.
     *
     * @param id     the unique identifier of the repository
     * @param url    the URL of the repository
     * @param layout the layout of the repository
     */
    public DefaultArtifactRepository( String id,
                                      String url,
                                      ArtifactRepositoryLayout layout )
    {
        this( id, url, layout, null, null );
    }

    /**
     * Create a remote deployment repository.
     *
     * @param id            the unique identifier of the repository
     * @param url           the URL of the repository
     * @param layout        the layout of the repository
     * @param uniqueVersion whether to assign each snapshot a unique version
     */
    public DefaultArtifactRepository( String id,
                                      String url,
                                      ArtifactRepositoryLayout layout,
                                      boolean uniqueVersion )
    {
        super( id, url );
        this.layout = layout;
        this.uniqueVersion = uniqueVersion;
    }

    /**
     * Create a remote download repository.
     *
     * @param id        the unique identifier of the repository
     * @param url       the URL of the repository
     * @param layout    the layout of the repository
     * @param snapshots the policies to use for snapshots
     * @param releases  the policies to use for releases
     */
    public DefaultArtifactRepository( String id,
                                      String url,
                                      ArtifactRepositoryLayout layout,
                                      ArtifactRepositoryPolicy snapshots,
                                      ArtifactRepositoryPolicy releases )
    {
        super( id, url );
        this.layout = layout;
        if ( snapshots == null )
        {
            snapshots = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
                ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
        }
        this.snapshots = snapshots;

        if ( releases == null )
        {
            releases = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
                ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
        }
        this.releases = releases;
    }
    public String pathOf( Artifact artifact )
    {
        return layout.pathOf( artifact );
    }
    public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
    {
        return layout.pathOfRemoteRepositoryMetadata( artifactMetadata );
    }
    public String pathOfLocalRepositoryMetadata( ProjectArtifactMetadata metadata,
                                                 ArtifactRepository repository )
    {
        return layout.pathOfLocalRepositoryMetadata( metadata, repository );
    }
    public ArtifactRepositoryLayout getLayout()
    {
        return layout;
    }
    public ArtifactRepositoryPolicy getSnapshots()
    {
        return snapshots;
    }
    public void setReleases( ArtifactRepositoryPolicy releases )
    {
        this.releases = releases;
    }
    public ArtifactRepositoryPolicy getReleases()
    {
        return releases;
    }
    public String getKey()
    {
        return getId();
    }
    public boolean isUniqueVersion()
    {
        return uniqueVersion;
    }
    public boolean isBlacklisted()
    {
        return blacklisted;
    }
    public void setBlacklisted( boolean blacklisted )
    {
        this.blacklisted = blacklisted;
    }
}

finally the layout calls pathOfLocalRepositoryMetadata( metadata, repository ) where metadata is
public class ProjectArtifactMetadata
    extends AbstractArtifactMetadata
{
    private final File file;

    public ProjectArtifactMetadata( Artifact artifact )
    {
        this( artifact, null );
    }

    public ProjectArtifactMetadata( Artifact artifact,
                                    File file )
    {
        super( artifact );
        this.file = file;
    }

    public String getRemoteFilename()
    {
        return getFilename();
    }

    public String getLocalFilename( ArtifactRepository repository )
    {
        return getFilename();
    }

    private String getFilename()
    {
        return getArtifactId() + "-" + artifact.getVersion() + ".pom";
    }

    public void storeInLocalRepository( ArtifactRepository localRepository,
                                        ArtifactRepository remoteRepository )
        throws RepositoryMetadataStoreException
    {
        File destination = new File( localRepository.getBasedir(),
                                     localRepository.pathOfLocalRepositoryMetadata( this, remoteRepository ) );

        // ----------------------------------------------------------------------------
        // I'm fully aware that the file could just be moved using File.rename but
        // there are bugs in various JVM that have problems doing this across
        // different filesystem. So we'll incur the small hit to actually copy
        // here and be safe. jvz.
        // ----------------------------------------------------------------------------
        try
        {
            FileUtils.copyFile( file, destination );
        }
        catch ( IOException e )
        {
            throw new RepositoryMetadataStoreException( "Error copying POM to the local repository.", e );
        }
    }

    public String toString()
    {
        return "project information for " + artifact.getArtifactId() + " " + artifact.getVersion();
    }

    public boolean storedInArtifactVersionDirectory()
    {
        return true;
    }

    public String getBaseVersion()
    {
        return artifact.getBaseVersion();
    }

    public Object getKey()
    {
        return "project " + artifact.getGroupId() + ":" + artifact.getArtifactId();
    }

    public void merge( ArtifactMetadata metadata )
    {
        ProjectArtifactMetadata m = (ProjectArtifactMetadata) metadata;
        if ( !m.file.equals( file ) )
        {
            throw new IllegalStateException( "Cannot add two different pieces of metadata for: " + getKey() );
        }
    }
}

//finally the ArtifactRepositoryLayout which is nothing more than an interface skeleton
/** @author jdcasey */
public interface ArtifactRepositoryLayout
{
    String ROLE = ArtifactRepositoryLayout.class.getName();

    String pathOf( Artifact artifact );

    String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata,
                                          ArtifactRepository repository );

    String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata );
}

HTH
Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Fri, 15 May 2009 12:39:15 -0700
> From: DSMILEY@mitre.org
> To: users@maven.apache.org
> Subject: Re: [maven 2] assembly: repository from multiple modules
> 
> 
> Any update to this?  I've tried a bunch of combinations.  I think at this
> point I'm going to try and hack the latest source to meet my needs.
> 
> ~ David
> 
> 
> Hal Hildebrand-3 wrote:
> > 
> > I have a large, multiple module project that I need to create a repository
> > assembly for.  I have no problems creating the binary, including the
> > dependencies. However, I can't seem to create a repository.  I'm running
> > the
> > assembly in the project's top level pom, of course, but from what I can
> > tell, there seems to be no way to indicated to use all the sub modules -
> > i.e. The only way to create the repository seems to be be placing all the
> > dependencies in the top level pom.  Obviously, this will be a nightmare to
> > maintain.  Also, since the binary assembly seems perfectly capable of
> > including the sub module's binaries and dependencies, it would seem that
> > the
> > repository assembly should be able to do the same.
> > 
> > Falling short of actually creating the repository for one reason or
> > another,
> > if I could get the format of the binary assembly to be identical to the
> > repository layout, that would be sufficient for my needs as I don't need
> > the
> > maven repository metadata.  Right now, I've tried using no outputfile
> > format, with simply a directory - doesn't work.  I've also tried using:
> > ${groupId}/${artifactId} as the directory - kind of works, but now I have
> > .'s instead of /'s in the repository group id directory.
> > 
> > Surely this is possible through some machination or incantation, right?
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/-maven-2--assembly%3A-repository-from-multiple-modules-tp8505848p23566098.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits.
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage1_052009

RE: [maven 2] assembly: repository from multiple modules

Posted by "Marilyn Sander (marilysa)" <ma...@cisco.com>.
I do this by starting the build using a local repository that is
completely empty to start with.  At the end of the build, the local
repository is completely populated with all artifacts that were
downloaded from central repositories, plus artifacts that were built and
installed using the "install" target.

Then I just zip up the local repository and save it.

There are arguments to the mvn command, plus environment variables, that
let you specify to build "offline", using only the contents of the local
repository.  From there on, just unzip and use that local repository and
do "offline" builds. 

--Marilyn

-----Original Message-----
From: David Smiley @MITRE.org [mailto:DSMILEY@mitre.org] 
Sent: Friday, May 15, 2009 2:07 PM
To: users@maven.apache.org
Subject: Re: [maven 2] assembly: repository from multiple modules


Hi; thanks for your interest.

The goal is to get a zip file that internally has the structure of a
maven repository containing every artifact referenced by the project.  I
need to do this because I need to install/develop software in an
environment that does not have network access.  I have a multi-module
project.  The parent pom is just a pom and it has the maven assembly
plugin defined and references an assembly configuration that uses the
repositories element. 
It's standard stuff.  On single-module projects this works fine -- I've
used the assembly plugin before.  But for a multi-module project, it
just doesn't seem to work.  It seemed to me after lots of trial and
error that I could get the assembly plugin to generate assemblies of
binaries and source of the entire project using moduleset, but not a
repository structure of all artifacts.

I dug into the source code and debugged a bit.  At the parent level pom
where the assembly plugin is invoked, it does *NOT* recursively look at
the modules to get their dependencies.  It just looks for dependencies
of the parent pom itself.  I imminently intend to fork this plugin for
my own purposes so that the getDependencieds() (or whatever method it
was when I was debugging -- I forget) recursively pulls in all
dependencies of child modules.

~ David



Baptiste MATHUS wrote:
> 
> Reading all this didn't let me with a sense of understanding, if you 
> see what I mean.
> Could you try and rephrase your need?
> 
> Cheers
> 
> 2009/5/15 David Smiley @MITRE.org <DS...@mitre.org>
> 
>>
>> Any update to this?  I've tried a bunch of combinations.  I think at 
>> this point I'm going to try and hack the latest source to meet my
needs.
>>
>> ~ David
>>
>>
>> Hal Hildebrand-3 wrote:
>> >
>> > I have a large, multiple module project that I need to create a
>> repository
>> > assembly for.  I have no problems creating the binary, including 
>> > the dependencies. However, I can't seem to create a repository.  
>> > I'm
>> running
>> > the
>> > assembly in the project's top level pom, of course, but from what I

>> > can tell, there seems to be no way to indicated to use all the sub 
>> > modules
>> -
>> > i.e. The only way to create the repository seems to be be placing 
>> > all
>> the
>> > dependencies in the top level pom.  Obviously, this will be a 
>> > nightmare
>> to
>> > maintain.  Also, since the binary assembly seems perfectly capable 
>> > of including the sub module's binaries and dependencies, it would 
>> > seem
>> that
>> > the
>> > repository assembly should be able to do the same.
>> >
>> > Falling short of actually creating the repository for one reason or

>> > another, if I could get the format of the binary assembly to be 
>> > identical to the repository layout, that would be sufficient for my

>> > needs as I don't
>> need
>> > the
>> > maven repository metadata.  Right now, I've tried using no 
>> > outputfile format, with simply a directory - doesn't work.  I've
also tried using:
>> > ${groupId}/${artifactId} as the directory - kind of works, but now 
>> > I
>> have
>> > .'s instead of /'s in the repository group id directory.
>> >
>> > Surely this is possible through some machination or incantation,
right?
>> >
>> >
>> >
>> > -------------------------------------------------------------------
>> > -- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-maven-2--assembly%3A-repository-from-multiple-
>> modules-tp8505848p23566098.html Sent from the Maven - Users mailing 
>> list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> --
> Baptiste <Batmat> MATHUS - http://batmat.net Sauvez un arbre, Mangez 
> un castor !
> 
> 

--
View this message in context:
http://www.nabble.com/-maven-2--assembly%3A-repository-from-multiple-mod
ules-tp8505848p23567293.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


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


Re: [maven 2] assembly: repository from multiple modules

Posted by "David Smiley @MITRE.org" <DS...@mitre.org>.
Hi; thanks for your interest.

The goal is to get a zip file that internally has the structure of a maven
repository containing every artifact referenced by the project.  I need to
do this because I need to install/develop software in an environment that
does not have network access.  I have a multi-module project.  The parent
pom is just a pom and it has the maven assembly plugin defined and
references an assembly configuration that uses the repositories element. 
It's standard stuff.  On single-module projects this works fine -- I've used
the assembly plugin before.  But for a multi-module project, it just doesn't
seem to work.  It seemed to me after lots of trial and error that I could
get the assembly plugin to generate assemblies of binaries and source of the
entire project using moduleset, but not a repository structure of all
artifacts.

I dug into the source code and debugged a bit.  At the parent level pom
where the assembly plugin is invoked, it does *NOT* recursively look at the
modules to get their dependencies.  It just looks for dependencies of the
parent pom itself.  I imminently intend to fork this plugin for my own
purposes so that the getDependencieds() (or whatever method it was when I
was debugging -- I forget) recursively pulls in all dependencies of child
modules.

~ David



Baptiste MATHUS wrote:
> 
> Reading all this didn't let me with a sense of understanding, if you see
> what I mean.
> Could you try and rephrase your need?
> 
> Cheers
> 
> 2009/5/15 David Smiley @MITRE.org <DS...@mitre.org>
> 
>>
>> Any update to this?  I've tried a bunch of combinations.  I think at this
>> point I'm going to try and hack the latest source to meet my needs.
>>
>> ~ David
>>
>>
>> Hal Hildebrand-3 wrote:
>> >
>> > I have a large, multiple module project that I need to create a
>> repository
>> > assembly for.  I have no problems creating the binary, including the
>> > dependencies. However, I can't seem to create a repository.  I'm
>> running
>> > the
>> > assembly in the project's top level pom, of course, but from what I can
>> > tell, there seems to be no way to indicated to use all the sub modules
>> -
>> > i.e. The only way to create the repository seems to be be placing all
>> the
>> > dependencies in the top level pom.  Obviously, this will be a nightmare
>> to
>> > maintain.  Also, since the binary assembly seems perfectly capable of
>> > including the sub module's binaries and dependencies, it would seem
>> that
>> > the
>> > repository assembly should be able to do the same.
>> >
>> > Falling short of actually creating the repository for one reason or
>> > another,
>> > if I could get the format of the binary assembly to be identical to the
>> > repository layout, that would be sufficient for my needs as I don't
>> need
>> > the
>> > maven repository metadata.  Right now, I've tried using no outputfile
>> > format, with simply a directory - doesn't work.  I've also tried using:
>> > ${groupId}/${artifactId} as the directory - kind of works, but now I
>> have
>> > .'s instead of /'s in the repository group id directory.
>> >
>> > Surely this is possible through some machination or incantation, right?
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-maven-2--assembly%3A-repository-from-multiple-modules-tp8505848p23566098.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> -- 
> Baptiste <Batmat> MATHUS - http://batmat.net
> Sauvez un arbre,
> Mangez un castor !
> 
> 

-- 
View this message in context: http://www.nabble.com/-maven-2--assembly%3A-repository-from-multiple-modules-tp8505848p23567293.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: [maven 2] assembly: repository from multiple modules

Posted by Baptiste MATHUS <ml...@batmat.net>.
Reading all this didn't let me with a sense of understanding, if you see
what I mean.
Could you try and rephrase your need?

Cheers

2009/5/15 David Smiley @MITRE.org <DS...@mitre.org>

>
> Any update to this?  I've tried a bunch of combinations.  I think at this
> point I'm going to try and hack the latest source to meet my needs.
>
> ~ David
>
>
> Hal Hildebrand-3 wrote:
> >
> > I have a large, multiple module project that I need to create a
> repository
> > assembly for.  I have no problems creating the binary, including the
> > dependencies. However, I can't seem to create a repository.  I'm running
> > the
> > assembly in the project's top level pom, of course, but from what I can
> > tell, there seems to be no way to indicated to use all the sub modules -
> > i.e. The only way to create the repository seems to be be placing all the
> > dependencies in the top level pom.  Obviously, this will be a nightmare
> to
> > maintain.  Also, since the binary assembly seems perfectly capable of
> > including the sub module's binaries and dependencies, it would seem that
> > the
> > repository assembly should be able to do the same.
> >
> > Falling short of actually creating the repository for one reason or
> > another,
> > if I could get the format of the binary assembly to be identical to the
> > repository layout, that would be sufficient for my needs as I don't need
> > the
> > maven repository metadata.  Right now, I've tried using no outputfile
> > format, with simply a directory - doesn't work.  I've also tried using:
> > ${groupId}/${artifactId} as the directory - kind of works, but now I have
> > .'s instead of /'s in the repository group id directory.
> >
> > Surely this is possible through some machination or incantation, right?
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/-maven-2--assembly%3A-repository-from-multiple-modules-tp8505848p23566098.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Re: [maven 2] assembly: repository from multiple modules

Posted by "David Smiley @MITRE.org" <DS...@mitre.org>.
Any update to this?  I've tried a bunch of combinations.  I think at this
point I'm going to try and hack the latest source to meet my needs.

~ David


Hal Hildebrand-3 wrote:
> 
> I have a large, multiple module project that I need to create a repository
> assembly for.  I have no problems creating the binary, including the
> dependencies. However, I can't seem to create a repository.  I'm running
> the
> assembly in the project's top level pom, of course, but from what I can
> tell, there seems to be no way to indicated to use all the sub modules -
> i.e. The only way to create the repository seems to be be placing all the
> dependencies in the top level pom.  Obviously, this will be a nightmare to
> maintain.  Also, since the binary assembly seems perfectly capable of
> including the sub module's binaries and dependencies, it would seem that
> the
> repository assembly should be able to do the same.
> 
> Falling short of actually creating the repository for one reason or
> another,
> if I could get the format of the binary assembly to be identical to the
> repository layout, that would be sufficient for my needs as I don't need
> the
> maven repository metadata.  Right now, I've tried using no outputfile
> format, with simply a directory - doesn't work.  I've also tried using:
> ${groupId}/${artifactId} as the directory - kind of works, but now I have
> .'s instead of /'s in the repository group id directory.
> 
> Surely this is possible through some machination or incantation, right?
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-maven-2--assembly%3A-repository-from-multiple-modules-tp8505848p23566098.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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