You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Yan Huang <az...@gmail.com> on 2007/10/08 23:33:51 UTC

Packaging type "zip"??

Hello,

I have these requirements to package a module:

   - it's group ID is different from what I have at the top level
   - no compilation or test is required
   - it just needs to be packaged in "zip" format
   - it needs to be deployed to a maven2 repository as part of deploy
   phase

Do you think I need to separate this module out from the overall package
because of different group ID? If I need to build it separately, what's
going to be the "packaging" type? Maven does not support "zip" packaging
type though, and I don't want an empty jar being created in order to attach
"zip" file in the "package" phase by using assembly plugin.

Any thoughts or suggestions?

Thanks
Yan

Re: Packaging type "zip"??

Posted by Yan Huang <az...@gmail.com>.
this is similar to what I've read in that book "definitive guide". can it be
published to codehaus or maven repository?

On 10/9/07, Tom Huybrechts <to...@gmail.com> wrote:
>
> On 10/8/07, Yan Huang <az...@gmail.com> wrote:
> > Hello,
> >
> > I have these requirements to package a module:
> >
> >    - it's group ID is different from what I have at the top level
> >    - no compilation or test is required
> >    - it just needs to be packaged in "zip" format
> >    - it needs to be deployed to a maven2 repository as part of deploy
> >    phase
> >
> > Do you think I need to separate this module out from the overall package
> > because of different group ID? If I need to build it separately, what's
> > going to be the "packaging" type? Maven does not support "zip" packaging
> > type though, and I don't want an empty jar being created in order to
> attach
> > "zip" file in the "package" phase by using assembly plugin.
> >
> > Any thoughts or suggestions?
> >
> > Thanks
> > Yan
> >
>
> Creating a plugin that provides a ZIP packaging is not that hard:
>
> Use this mojo:
>
> ================
>
> import java.io.File;
>
> import org.apache.maven.plugin.AbstractMojo;
> import org.apache.maven.plugin.MojoExecutionException;
> import org.apache.maven.project.MavenProject;
> import org.apache.maven.project.MavenProjectHelper;
> import org.codehaus.plexus.archiver.zip.ZipArchiver;
>
> /**
> * Creates a zip from the output directory, and sets it as the project
> artifact.
> *
> * @goal zip
> * @phase package
> * @requiresProject true
> */
> public class ZipMojo extends AbstractMojo {
>
>    public static final String[] DEFAULT_EXCLUDES = {
>        // Miscellaneous typical temporary files
>        "**/*~",
>        "**/#*#",
>        "**/.#*",
>        "**/%*%",
>        "**/._*",
>
>        // CVS
>        "**/CVS",
>        "**/CVS/**",
>        "**/.cvsignore",
>
>        // SCCS
>        "**/SCCS",
>        "**/SCCS/**",
>
>        // Visual SourceSafe
>        "**/vssver.scc",
>
>        // Subversion
>        "**/.svn",
>        "**/.svn/**",
>
>        // Arch/Bazaar
>        "**/.arch-ids", "**/.arch-ids/**",
>
>        // Mac
>        "**/.DS_Store"
>    };
>
>    private static final String[] DEFAULT_INCLUDES = new String[]{"**/**"};
>
>    /**
>     * Directory containing the generated ZIP.
>     *
>     * @parameter expression="${project.build.directory}"
>     * @required
>     */
>    private File outputDirectory;
>
>    /**
>     * Name of the generated ZIP.
>     *
>     * @parameter alias="zipName" expression="${project.build.finalName}"
>     * @required
>     */
>    private String finalName;
>
>    /**
>     * The Jar archiver.
>     *
>     * @parameter
> expression="${component.org.codehaus.plexus.archiver.Archiver#zip}"
>     * @required
>     */
>    private ZipArchiver zipArchiver;
>
>    /**
>     * The maven project.
>     *
>     * @parameter expression="${project}"
>     * @required
>     * @readonly
>     */
>    private MavenProject project;
>
>    /**
>     * @component
>     */
>    private MavenProjectHelper projectHelper;
>
>    /**
>     * Whether creating the archive should be forced.
>     * @parameter expression="${jar.forceCreation}" default-value="false"
>     */
>    private boolean forceCreation;
>
>    /**
>     * Directory containing the classes.
>     *
>     * @parameter expression="${project.build.outputDirectory}"
>     * @required
>     */
>    private File classesDirectory;
>
>    /**
>     * Classifier to add to the artifact generated. If given, the
> artifact will be an attachment instead.
>     *
>     * @parameter
>     */
>    private String classifier;
>
>    protected String getClassifier()
>    {
>        return classifier;
>    }
>
>    /**
>     * Return the main classes directory, so it's used as the root of the
> jar.
>     */
>    protected File getClassesDirectory()
>    {
>        return classesDirectory;
>    }
>
>
>    protected final MavenProject getProject()
>    {
>        return project;
>    }
>
>    protected static File getZipFile( File basedir, String finalName,
> String classifier )
>    {
>        if ( classifier == null )
>        {
>            classifier = "";
>        }
>        else if ( classifier.trim().length() > 0 &&
> !classifier.startsWith( "-" ) )
>        {
>            classifier = "-" + classifier;
>        }
>
>        return new File( basedir, finalName + classifier + ".zip" );
>    }
>
>    /**
>     * Generates the ZIP.
>     *
>     * @todo Add license files in META-INF directory.
>     */
>    public File createArchive()
>        throws MojoExecutionException
>    {
>        File zipFile = getZipFile( outputDirectory, finalName,
> getClassifier() );
>
>        try
>        {
>            File contentDirectory = getClassesDirectory();
>            if ( !contentDirectory.exists() )
>            {
>                getLog().warn( "ZIP will be empty - no content was
> marked for inclusion!" );
>            }
>            else
>            {
>                zipArchiver.addDirectory( contentDirectory,
> DEFAULT_INCLUDES, DEFAULT_EXCLUDES );
>            }
>
>            zipArchiver.setForced(forceCreation);
>            zipArchiver.setDestFile(zipFile);
>            zipArchiver.createArchive();
>
>
>            return zipFile;
>        }
>        catch ( Exception e )
>        {
>            throw new MojoExecutionException( "Error assembling ZIP", e );
>        }
>    }
>
>    /**
>     * Generates the ZIP.
>     *
>     * @todo Add license files in META-INF directory.
>     */
>    public void execute()
>        throws MojoExecutionException
>    {
>        File zipFile = createArchive();
>
>        String classifier = getClassifier();
>        if ( classifier != null )
>        {
>            projectHelper.attachArtifact( getProject(), "zip",
> classifier, zipFile );
>        }
>        else
>        {
>            getProject().getArtifact().setFile( zipFile );
>        }
>    }
> }
>
> ==================
>
> and put this in META-INF\plexus\components.xml:
>
> <component-set>
>        <components>
>                <component>
>
> <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
>                        <role-hint>zip</role-hint>
>                        <implementation>
>
> org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
>                        </implementation>
>                        <configuration>
>                                <phases>
>                                        <process-resources>
>
> org.apache.maven.plugins:maven-resources-plugin:resources
>                                        </process-resources>
>
> <package>groupId:maven-zip-plugin:zip</package>
>
> <install>org.apache.maven.plugins:maven-install-plugin:install</install>
>
> <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
>                                </phases>
>                        </configuration>
>                </component>
>                <component>
>
> <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
>                        <role-hint>zip</role-hint>
>                        <implementation>
>
> org.apache.maven.artifact.handler.DefaultArtifactHandler
>                        </implementation>
>                        <configuration>
>                                <extension>zip</extension>
>                                <type>zip</type>
>                                <packaging>zip</packaging>
>                                <addedToClasspath>false</addedToClasspath>
>
> <includesDependencies>true</includesDependencies>
>                        </configuration>
>                </component>
>        </components>
> </component-set>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Packaging type "zip"??

Posted by Tom Huybrechts <to...@gmail.com>.
On 10/8/07, Yan Huang <az...@gmail.com> wrote:
> Hello,
>
> I have these requirements to package a module:
>
>    - it's group ID is different from what I have at the top level
>    - no compilation or test is required
>    - it just needs to be packaged in "zip" format
>    - it needs to be deployed to a maven2 repository as part of deploy
>    phase
>
> Do you think I need to separate this module out from the overall package
> because of different group ID? If I need to build it separately, what's
> going to be the "packaging" type? Maven does not support "zip" packaging
> type though, and I don't want an empty jar being created in order to attach
> "zip" file in the "package" phase by using assembly plugin.
>
> Any thoughts or suggestions?
>
> Thanks
> Yan
>

Creating a plugin that provides a ZIP packaging is not that hard:

Use this mojo:

================

import java.io.File;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.archiver.zip.ZipArchiver;

/**
 * Creates a zip from the output directory, and sets it as the project artifact.
 *
 * @goal zip
 * @phase package
 * @requiresProject true
 */
public class ZipMojo extends AbstractMojo {

    public static final String[] DEFAULT_EXCLUDES = {
        // Miscellaneous typical temporary files
        "**/*~",
        "**/#*#",
        "**/.#*",
        "**/%*%",
        "**/._*",

        // CVS
        "**/CVS",
        "**/CVS/**",
        "**/.cvsignore",

        // SCCS
        "**/SCCS",
        "**/SCCS/**",

        // Visual SourceSafe
        "**/vssver.scc",

        // Subversion
        "**/.svn",
        "**/.svn/**",

        // Arch/Bazaar
        "**/.arch-ids", "**/.arch-ids/**",

        // Mac
        "**/.DS_Store"
    };

    private static final String[] DEFAULT_INCLUDES = new String[]{"**/**"};

    /**
     * Directory containing the generated ZIP.
     *
     * @parameter expression="${project.build.directory}"
     * @required
     */
    private File outputDirectory;

    /**
     * Name of the generated ZIP.
     *
     * @parameter alias="zipName" expression="${project.build.finalName}"
     * @required
     */
    private String finalName;

    /**
     * The Jar archiver.
     *
     * @parameter
expression="${component.org.codehaus.plexus.archiver.Archiver#zip}"
     * @required
     */
    private ZipArchiver zipArchiver;

    /**
     * The maven project.
     *
     * @parameter expression="${project}"
     * @required
     * @readonly
     */
    private MavenProject project;

    /**
     * @component
     */
    private MavenProjectHelper projectHelper;

    /**
     * Whether creating the archive should be forced.
     * @parameter expression="${jar.forceCreation}" default-value="false"
     */
    private boolean forceCreation;

    /**
     * Directory containing the classes.
     *
     * @parameter expression="${project.build.outputDirectory}"
     * @required
     */
    private File classesDirectory;

    /**
     * Classifier to add to the artifact generated. If given, the
artifact will be an attachment instead.
     *
     * @parameter
     */
    private String classifier;

    protected String getClassifier()
    {
        return classifier;
    }

    /**
     * Return the main classes directory, so it's used as the root of the jar.
     */
    protected File getClassesDirectory()
    {
        return classesDirectory;
    }


    protected final MavenProject getProject()
    {
        return project;
    }

    protected static File getZipFile( File basedir, String finalName,
String classifier )
    {
        if ( classifier == null )
        {
            classifier = "";
        }
        else if ( classifier.trim().length() > 0 &&
!classifier.startsWith( "-" ) )
        {
            classifier = "-" + classifier;
        }

        return new File( basedir, finalName + classifier + ".zip" );
    }

    /**
     * Generates the ZIP.
     *
     * @todo Add license files in META-INF directory.
     */
    public File createArchive()
        throws MojoExecutionException
    {
        File zipFile = getZipFile( outputDirectory, finalName,
getClassifier() );

        try
        {
            File contentDirectory = getClassesDirectory();
            if ( !contentDirectory.exists() )
            {
                getLog().warn( "ZIP will be empty - no content was
marked for inclusion!" );
            }
            else
            {
                zipArchiver.addDirectory( contentDirectory,
DEFAULT_INCLUDES, DEFAULT_EXCLUDES );
            }

            zipArchiver.setForced(forceCreation);
            zipArchiver.setDestFile(zipFile);
            zipArchiver.createArchive();


            return zipFile;
        }
        catch ( Exception e )
        {
            throw new MojoExecutionException( "Error assembling ZIP", e );
        }
    }

    /**
     * Generates the ZIP.
     *
     * @todo Add license files in META-INF directory.
     */
    public void execute()
        throws MojoExecutionException
    {
        File zipFile = createArchive();

        String classifier = getClassifier();
        if ( classifier != null )
        {
            projectHelper.attachArtifact( getProject(), "zip",
classifier, zipFile );
        }
        else
        {
            getProject().getArtifact().setFile( zipFile );
        }
    }
}

==================

and put this in META-INF\plexus\components.xml:

<component-set>
        <components>
                <component>

<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
                        <role-hint>zip</role-hint>
                        <implementation>

org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
                        </implementation>
                        <configuration>
                                <phases>
                                        <process-resources>

org.apache.maven.plugins:maven-resources-plugin:resources
                                        </process-resources>

<package>groupId:maven-zip-plugin:zip</package>

<install>org.apache.maven.plugins:maven-install-plugin:install</install>

<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
                                </phases>
                        </configuration>
                </component>
                <component>

<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
                        <role-hint>zip</role-hint>
                        <implementation>

org.apache.maven.artifact.handler.DefaultArtifactHandler
                        </implementation>
                        <configuration>
                                <extension>zip</extension>
                                <type>zip</type>
                                <packaging>zip</packaging>
                                <addedToClasspath>false</addedToClasspath>

<includesDependencies>true</includesDependencies>
                        </configuration>
                </component>
        </components>
</component-set>

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


Re: Packaging type "zip"??

Posted by Stephen More <st...@gmail.com>.
Has anyone used the maven-assembly-plugin to build Java Programs on
the Sharp Zaurus (
http://developers.sun.com/mobility/personal/articles/ztutorial/ )

It looks like it would need:
   - a parent pom assembly tar.gz of the 2 child poms
   - child1 assembly tar.gz of control file
   - child2 assembly tar.gz of class files and resources

Or is there a easier way ?

-Thanks
Steve More

On 10/8/07, Mark Struberg <str.....de> wrote:
> Hi!
>
> What about the maven-assembly-plugin?
>
> It is very simple to use, and you can specify exactly
> what to zip.

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


Re: Packaging type "zip"??

Posted by Tim Kettler <ti...@udo.edu>.
The project's pom will be deployed regardless of the packaging type. It 
would be deployed even if a packaging type 'zip' would exist.

-Tim

Yan Huang schrieb:
> however, this "pom" file (with packaging type "pom") would be deployed to
> repository though. It'll be misleading since the artifact is in "zip" format
> ...
> 
> On 10/9/07, Mark Struberg <st...@yahoo.de> wrote:
>> --- Yan Huang <az...@gmail.com> schrieb:
>>> but you'll also get empty jar deployed in your
>>> repository, which is not what i want
>> And setting the <packaging>pom</packaging>?
>> This is what i have, and after a mvn install i get:
>>
>> [msx@msx plat.v3.handset.devices]$ ls -1l
>>
>> ~/.m2/repository/com/3united/content/plat/v3/plat.v3.handset.devices/2.0.2-SNAPSHOT/
>> insgesamt 212
>> -rw-rw-r-- 1 msx msx    338  9. Okt 17:57
>> maven-metadata-local.xml
>> -rw-rw-r-- 1 msx msx 192413  9. Okt 17:57
>> plat.v3.handset.devices-2.0.2-SNAPSHOT-devices.zip
>> -rw-rw-r-- 1 msx msx   1746  9. Okt 17:57
>> plat.v3.handset.devices-2.0.2-SNAPSHOT.pom
>>
>>
>> LieGrü,
>> strub
>>
>>
>>
>>       Machen Sie Yahoo! zu Ihrer Startseite. Los geht's:
>> http://de.yahoo.com/set
>>
>> ---------------------------------------------------------------------
>> 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: Packaging type "zip"??

Posted by Yan Huang <az...@gmail.com>.
however, this "pom" file (with packaging type "pom") would be deployed to
repository though. It'll be misleading since the artifact is in "zip" format
...

On 10/9/07, Mark Struberg <st...@yahoo.de> wrote:
>
> --- Yan Huang <az...@gmail.com> schrieb:
> > but you'll also get empty jar deployed in your
> > repository, which is not what i want
>
> And setting the <packaging>pom</packaging>?
> This is what i have, and after a mvn install i get:
>
> [msx@msx plat.v3.handset.devices]$ ls -1l
>
> ~/.m2/repository/com/3united/content/plat/v3/plat.v3.handset.devices/2.0.2-SNAPSHOT/
> insgesamt 212
> -rw-rw-r-- 1 msx msx    338  9. Okt 17:57
> maven-metadata-local.xml
> -rw-rw-r-- 1 msx msx 192413  9. Okt 17:57
> plat.v3.handset.devices-2.0.2-SNAPSHOT-devices.zip
> -rw-rw-r-- 1 msx msx   1746  9. Okt 17:57
> plat.v3.handset.devices-2.0.2-SNAPSHOT.pom
>
>
> LieGrü,
> strub
>
>
>
>       Machen Sie Yahoo! zu Ihrer Startseite. Los geht's:
> http://de.yahoo.com/set
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Packaging type "zip"??

Posted by Andrius Šabanas <an...@pivotcapital.com>.
Yan Huang wrote:
> but you'll also get empty jar deployed in your repository, which is not what
> I want ...

Hi,

Specify <packaging>pom</packaging> instead of "jar" in your pom, and no 
jar file will be created or deployed.


cheers,

Andrius

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


Re: Packaging type "zip"??

Posted by Tim Kettler <ti...@udo.edu>.
Only if you have a packaging type 'jar'. When you change the type to
'pom', no jar will be generated.

-Tim

Am Tue, 9 Oct 2007 08:21:47 -0700
schrieb "Yan Huang" <az...@gmail.com>:

> but you'll also get empty jar deployed in your repository, which is
> not what I want ...
> 
> do we have a "maven-zip-plugin" which defines the life-cycle of
> packaging type "zip"? I saw there is pseudo code in that book called
> "the definitive guide - maven". Before I could dive in further, I'm
> wondering if such plugin is already available out there.
> Unfortunately , googling it didn't yield anything useful ...
> 
> On 10/9/07, Mark Struberg <st...@yahoo.de> wrote:
> >
> > Hi!
> >
> > Maybe i did not get the point, but the zip file is
> > marked as attached artifact since i specified
> > >   <execution>
> > >     <id>make-assembly</id>
> > >     <phase>package</phase>
> > >     <goals>
> > >       <goal>attached</goal>
> > >     </goals>
> > >   </execution>
> >
> > So whenever i do a mvn install, deploy or even a full
> > release i get the attached zip in my repository.
> >
> > LieGrü,
> > strub
> >
> >
> >
> > --- Wayne Fay <wa...@gmail.com> schrieb:
> >
> > > > for that module. I might end up using
> > > "deploy-file" to accomplish it
> > > > manually ...
> > >
> > > That's what I would do.
> > >
> > > Wayne
> >
> >
> >       Wissenswertes für Bastler und Hobby Handwerker. BE A BETTER
> > HEIMWERKER! www.yahoo.de/clever
> >
> > ---------------------------------------------------------------------
> > 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: Packaging type "zip"??

Posted by Mark Struberg <st...@yahoo.de>.
--- Yan Huang <az...@gmail.com> schrieb:
> but you'll also get empty jar deployed in your
> repository, which is not what i want

And setting the <packaging>pom</packaging>?
This is what i have, and after a mvn install i get:

[msx@msx plat.v3.handset.devices]$ ls -1l 
~/.m2/repository/com/3united/content/plat/v3/plat.v3.handset.devices/2.0.2-SNAPSHOT/
insgesamt 212
-rw-rw-r-- 1 msx msx    338  9. Okt 17:57
maven-metadata-local.xml
-rw-rw-r-- 1 msx msx 192413  9. Okt 17:57
plat.v3.handset.devices-2.0.2-SNAPSHOT-devices.zip
-rw-rw-r-- 1 msx msx   1746  9. Okt 17:57
plat.v3.handset.devices-2.0.2-SNAPSHOT.pom


LieGrü,
strub



      Machen Sie Yahoo! zu Ihrer Startseite. Los geht's: 
http://de.yahoo.com/set

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


RE: Packaging type "zip"??

Posted by LAMY Olivier <Ol...@accor.com>.
Hi,
There is an issue here http://jira.codehaus.org/browse/MNG-1683.
The issue is closed. As I remember it's in the current trunk (not checked).



--
Olivier 

-----Message d'origine-----
De : Yan Huang [mailto:azyhuang@gmail.com] 
Envoyé : mardi 9 octobre 2007 17:22
À : Maven Users List
Objet : Re: Packaging type "zip"??

but you'll also get empty jar deployed in your repository, which is not what I want ...

do we have a "maven-zip-plugin" which defines the life-cycle of packaging type "zip"? I saw there is pseudo code in that book called "the definitive guide - maven". Before I could dive in further, I'm wondering if such plugin is already available out there. Unfortunately , googling it didn't yield anything useful ...

On 10/9/07, Mark Struberg <st...@yahoo.de> wrote:
>
> Hi!
>
> Maybe i did not get the point, but the zip file is marked as attached 
> artifact since i specified
> >   <execution>
> >     <id>make-assembly</id>
> >     <phase>package</phase>
> >     <goals>
> >       <goal>attached</goal>
> >     </goals>
> >   </execution>
>
> So whenever i do a mvn install, deploy or even a full release i get 
> the attached zip in my repository.
>
> LieGrü,
> strub
>
>
>
> --- Wayne Fay <wa...@gmail.com> schrieb:
>
> > > for that module. I might end up using
> > "deploy-file" to accomplish it
> > > manually ...
> >
> > That's what I would do.
> >
> > Wayne
>
>
>       Wissenswertes für Bastler und Hobby Handwerker. BE A BETTER 
> HEIMWERKER! www.yahoo.de/clever
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


This e-mail, any attachments and the information contained therein ("this message") are confidential and intended solely for the use of the addressee(s). If you have received this message in error please send it back to the sender and delete it. Unauthorized publication, use, dissemination or disclosure of this message, either in whole or in part is strictly prohibited.
--------------------------------------------------------------------------------------------------------------
Ce message électronique et tous les fichiers joints ainsi que  les informations contenues dans ce message ( ci après "le message" ), sont confidentiels et destinés exclusivement à l'usage de la  personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci  de le renvoyer à son émetteur et de le détruire. Toutes diffusion, publication, totale ou partielle ou divulgation sous quelque forme que se soit non expressément autorisées de ce message, sont interdites.
-------------------------------------------------------------------------------------------------------------


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


Re: Packaging type "zip"??

Posted by Yan Huang <az...@gmail.com>.
but you'll also get empty jar deployed in your repository, which is not what
I want ...

do we have a "maven-zip-plugin" which defines the life-cycle of packaging
type "zip"? I saw there is pseudo code in that book called "the definitive
guide - maven". Before I could dive in further, I'm wondering if such plugin
is already available out there. Unfortunately , googling it didn't yield
anything useful ...

On 10/9/07, Mark Struberg <st...@yahoo.de> wrote:
>
> Hi!
>
> Maybe i did not get the point, but the zip file is
> marked as attached artifact since i specified
> >   <execution>
> >     <id>make-assembly</id>
> >     <phase>package</phase>
> >     <goals>
> >       <goal>attached</goal>
> >     </goals>
> >   </execution>
>
> So whenever i do a mvn install, deploy or even a full
> release i get the attached zip in my repository.
>
> LieGrü,
> strub
>
>
>
> --- Wayne Fay <wa...@gmail.com> schrieb:
>
> > > for that module. I might end up using
> > "deploy-file" to accomplish it
> > > manually ...
> >
> > That's what I would do.
> >
> > Wayne
>
>
>       Wissenswertes für Bastler und Hobby Handwerker. BE A BETTER
> HEIMWERKER! www.yahoo.de/clever
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Packaging type "zip"??

Posted by Mark Struberg <st...@yahoo.de>.
Hi!

Maybe i did not get the point, but the zip file is
marked as attached artifact since i specified
>   <execution>
>     <id>make-assembly</id>
>     <phase>package</phase>
>     <goals>
>       <goal>attached</goal>
>     </goals>
>   </execution>

So whenever i do a mvn install, deploy or even a full
release i get the attached zip in my repository.

LieGrü,
strub



--- Wayne Fay <wa...@gmail.com> schrieb:

> > for that module. I might end up using
> "deploy-file" to accomplish it
> > manually ...
> 
> That's what I would do.
> 
> Wayne


      Wissenswertes für Bastler und Hobby Handwerker. BE A BETTER HEIMWERKER! www.yahoo.de/clever

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


Re: Packaging type "zip"??

Posted by Wayne Fay <wa...@gmail.com>.
> for that module. I might end up using "deploy-file" to accomplish it
> manually ...

That's what I would do.

Wayne

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


Re: Packaging type "zip"??

Posted by Yan Huang <az...@gmail.com>.
this is exactly what i'm using right now, but I'm looking for more:)

basically, what I'm looking for is a "hypothetical" "zip" packaging type,
which would just cut a zip as specified (by probably using assembly plugin)
and get it deployed to repository as there is nothing to compile and test
for that module. I might end up using "deploy-file" to accomplish it
manually ...

On 10/8/07, Mark Struberg <st...@yahoo.de> wrote:
>
> Hi!
>
> What about the maven-assembly-plugin?
>
> It is very simple to use, and you can specify exactly
> what to zip.
>
> http://maven.apache.org/plugins/maven-assembly-plugin/
>
> what do u need:
>
> 1st the plugin:
>       <!-- create the
> ${artifactId}-${version}-resources.zip during the
> packaging -->
>       <plugin>
>         <artifactId>maven-assembly-plugin</artifactId>
>         <configuration>
>           <descriptors>
>
> <descriptor>src/assembly/config-resources.xml</descriptor>
>
> <descriptor>src/assembly/sql-resources.xml</descriptor>
>           </descriptors>
>         </configuration>
>                                 <executions>
>           <execution>
>             <id>make-assembly</id>
>             <phase>package</phase>
>             <goals>
>               <goal>attached</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>
>
> 2nd you need the assembly descriptors. here is an
> example (src/assembly/sql-resources.xml):
> <assembly>
>   <id>sql-resources</id>
>   <includeBaseDirectory>false</includeBaseDirectory>
>   <formats>
>     <format>zip</format>
>   </formats>
>   <fileSets>
>                 <fileSet>
>       <directory>sql</directory>
>       <outputDirectory>sql</outputDirectory>
>       <includes>
>         <include>**/*.*</include>
>       </includes>
>       <excludes>
>         <exclude>CVS</exclude>
>         <exclude>**/misc/**/*.*</exclude>
>       </excludes>
>     </fileSet>
>   </fileSets>
> </assembly>
>
> Hope this is what u need.
>
> LieGrü,
> strub
>
> --- Yan Huang <az...@gmail.com> schrieb:
>
> > Hello,
> >
> > I have these requirements to package a module:
> >
> >    - it's group ID is different from what I have at
> > the top level
> >    - no compilation or test is required
> >    - it just needs to be packaged in "zip" format
> >    - it needs to be deployed to a maven2 repository
> > as part of deploy
> >    phase
> >
> > Do you think I need to separate this module out from
> > the overall package
> > because of different group ID? If I need to build it
> > separately, what's
> > going to be the "packaging" type? Maven does not
> > support "zip" packaging
> > type though, and I don't want an empty jar being
> > created in order to attach
> > "zip" file in the "package" phase by using assembly
> > plugin.
> >
> > Any thoughts or suggestions?
> >
> > Thanks
> > Yan
> >
>
>
>
>       Jetzt Mails schnell in einem Vorschaufenster überfliegen. Dies und
> viel mehr bietet das neue Yahoo! Mail - www.yahoo.de/mail
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: Packaging type "zip"??

Posted by Mark Struberg <st...@yahoo.de>.
Hi!

What about the maven-assembly-plugin?

It is very simple to use, and you can specify exactly
what to zip.

http://maven.apache.org/plugins/maven-assembly-plugin/

what do u need:

1st the plugin:
      <!-- create the
${artifactId}-${version}-resources.zip during the
packaging -->
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
           
<descriptor>src/assembly/config-resources.xml</descriptor>
           
<descriptor>src/assembly/sql-resources.xml</descriptor>
          </descriptors>
        </configuration>
				<executions>
          <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>attached</goal>
            </goals>
          </execution>
        </executions>        
      </plugin>


2nd you need the assembly descriptors. here is an
example (src/assembly/sql-resources.xml):
<assembly>
  <id>sql-resources</id>
  <includeBaseDirectory>false</includeBaseDirectory>
  <formats>
    <format>zip</format>
  </formats>
  <fileSets>
		<fileSet>
      <directory>sql</directory>
      <outputDirectory>sql</outputDirectory>
      <includes>
        <include>**/*.*</include>
      </includes>
      <excludes>
        <exclude>CVS</exclude>
        <exclude>**/misc/**/*.*</exclude>
      </excludes>
    </fileSet>
  </fileSets>
</assembly>

Hope this is what u need.

LieGrü,
strub

--- Yan Huang <az...@gmail.com> schrieb:

> Hello,
> 
> I have these requirements to package a module:
> 
>    - it's group ID is different from what I have at
> the top level
>    - no compilation or test is required
>    - it just needs to be packaged in "zip" format
>    - it needs to be deployed to a maven2 repository
> as part of deploy
>    phase
> 
> Do you think I need to separate this module out from
> the overall package
> because of different group ID? If I need to build it
> separately, what's
> going to be the "packaging" type? Maven does not
> support "zip" packaging
> type though, and I don't want an empty jar being
> created in order to attach
> "zip" file in the "package" phase by using assembly
> plugin.
> 
> Any thoughts or suggestions?
> 
> Thanks
> Yan
> 



      Jetzt Mails schnell in einem Vorschaufenster überfliegen. Dies und viel mehr bietet das neue Yahoo! Mail - www.yahoo.de/mail

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