You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by ziprman <zi...@gmail.com> on 2008/05/16 21:16:53 UTC

second zip artifact from the same pom?

Hi,

I have a typical war webapp which I deploy to tomcat. At the same time I
have the typical static content (images, js, css) that needs to go to my
webservers. It is easy enough to exclude the static content from my war, but
I would like to zip up the static content and also deploy it to my repos as
a separate artifact. Both attached to a phase and as an independent command,
would be optimal, because we often update static content without needing to
deploy the app.

I have read some older postings about using assemblies (I have not used this
plugin before) and the maven-zip-plugin, as both a standalone archetype and
a build-plugin. Unfortunately, I am unsure which applies to my use case. I
suppose I could also just use an ant task, as well.

I was just wondering if anyone has done this and what is the best approach.

Thanks, James

RE: second zip artifact from the same pom?

Posted by EJ Ciramella <ej...@upromise.com>.
Additionally, you can use the "attach" option to make it part of the
regular build rather than having an extra step... 

-----Original Message-----
From: matthew sporleder [mailto:msporleder@gmail.com] 
Sent: Friday, May 16, 2008 4:02 PM
To: Maven Users List
Subject: Re: second zip artifact from the same pom?

On Fri, May 16, 2008 at 3:16 PM, ziprman <zi...@gmail.com> wrote:
> Hi,
>
> I have a typical war webapp which I deploy to tomcat. At the same time
I
> have the typical static content (images, js, css) that needs to go to
my
> webservers. It is easy enough to exclude the static content from my
war, but
> I would like to zip up the static content and also deploy it to my
repos as
> a separate artifact. Both attached to a phase and as an independent
command,
> would be optimal, because we often update static content without
needing to
> deploy the app.
>
> I have read some older postings about using assemblies (I have not
used this
> plugin before) and the maven-zip-plugin, as both a standalone
archetype and
> a build-plugin. Unfortunately, I am unsure which applies to my use
case. I
> suppose I could also just use an ant task, as well.
>
> I was just wondering if anyone has done this and what is the best
approach.
>


You can do this with assemblies using sources/fileSets without too much
trouble.
(this assumes you want all of your resources/ put into the zip in a
module called something-front)
into your pom:
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>src/assembly/assembly.xml</descriptor>
          </descriptors>
        </configuration>
      </plugin>
    </plugins>
  </build>

assembly.xml:
<assembly>
 <id>front-assembly</id>
 <formats>
  <format>zip</format>
 </formats>
<includeBaseDirectory>false</includeBaseDirectory>

  <moduleSets>
    <moduleSet>
      <includes>
        <include>*-front</include>
      </includes>
      <sources>
        <includeModuleDirectory>false</includeModuleDirectory>
        <fileSets>
          <fileSet>
            <directory>src/main/resources/</directory>
            <outputDirectory>/</outputDirectory>
          </fileSet>
        </fileSets>
      </sources>
    </moduleSet>
  </moduleSets>

</assembly>

---------------------------------------------------------------------
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: second zip artifact from the same pom?

Posted by matthew sporleder <ms...@gmail.com>.
On Fri, May 16, 2008 at 3:16 PM, ziprman <zi...@gmail.com> wrote:
> Hi,
>
> I have a typical war webapp which I deploy to tomcat. At the same time I
> have the typical static content (images, js, css) that needs to go to my
> webservers. It is easy enough to exclude the static content from my war, but
> I would like to zip up the static content and also deploy it to my repos as
> a separate artifact. Both attached to a phase and as an independent command,
> would be optimal, because we often update static content without needing to
> deploy the app.
>
> I have read some older postings about using assemblies (I have not used this
> plugin before) and the maven-zip-plugin, as both a standalone archetype and
> a build-plugin. Unfortunately, I am unsure which applies to my use case. I
> suppose I could also just use an ant task, as well.
>
> I was just wondering if anyone has done this and what is the best approach.
>


You can do this with assemblies using sources/fileSets without too much trouble.
(this assumes you want all of your resources/ put into the zip in a
module called something-front)
into your pom:
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>src/assembly/assembly.xml</descriptor>
          </descriptors>
        </configuration>
      </plugin>
    </plugins>
  </build>

assembly.xml:
<assembly>
 <id>front-assembly</id>
 <formats>
  <format>zip</format>
 </formats>
<includeBaseDirectory>false</includeBaseDirectory>

  <moduleSets>
    <moduleSet>
      <includes>
        <include>*-front</include>
      </includes>
      <sources>
        <includeModuleDirectory>false</includeModuleDirectory>
        <fileSets>
          <fileSet>
            <directory>src/main/resources/</directory>
            <outputDirectory>/</outputDirectory>
          </fileSet>
        </fileSets>
      </sources>
    </moduleSet>
  </moduleSets>

</assembly>

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