Quantcast

Skipping the TAR packaging step

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Skipping the TAR packaging step

jackett_dad
Hello,

I'm working on a large project that takes time to compile.  I would like to instruct Maven to only build the jar file, but after the build I have a tar, tar.bz2, and a zip file.  I am brand new to Maven, but have converted a project to use Maven for the compilation of all component modules.  In general, I want to indicate to Maven to only create me a jar with all dependencies rolled into that jar, and nothing else.  This can be for a particular profile, one for specific for development.  The wait is too long when I make a small change.

So I have a parent pom that is the kind that aggregates all sub-modules.  In any given module that I want to generate an executable jar for, I have a section that looks like this:

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven.assembly.plugin.version}</version>

                <configuration>
                    <descriptors>
                        <descriptor>../config/maven/single-jar-assembly.xml</descriptor>
                    </descriptors>
                    <archive>
                        <manifest>
                            <mainClass>com.company.MainClass</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

The assembly starts like this:

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    <id>all</id>
    <formats>
        <format>jar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>

I don't have any concept of a profile right now, but I want right now to simply suppress the creation of all the extra build artifacts.  Is there a way to do that?  

Sorry if it's been asked before, but I have either not found it, or when I did find it, I didn't understand what needed to be done.  I barely eked out the assembly.xml that I did create.

Thanks for any help you can provide,

Scott
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Skipping the TAR packaging step

Wayne Fay
> I'm working on a large project that takes time to compile.  I would like

Realistically I think you should be looking for LOCAL help (from
someone else in your project team, who knows Maven better than you do
-- who set these projects up originally?) rather than asking here on
Maven Users...

> instruct Maven to only build the jar file, but after the build I have a tar,

This should be pretty simple since Jars are the default.

> tar.bz2, and a zip file.  I am brand new to Maven, but have converted a
> project to use Maven for the compilation of all component modules.  In

You "converted" from what - Ant?

> general, I want to indicate to Maven to only create me a jar with all
> dependencies rolled into that jar, and nothing else.  This can be for a

You do realize that very few classloaders will support the "jar in a
jar" approach, right? You should probably look into the shade plugin
if you seriously want to pursue this.

> So I have a parent pom that is the kind that aggregates all sub-modules.  In
> any given module that I want to generate an executable jar for, I have a
> section that looks like this:

Nothing that you've sent shows anything about tar, bz2 or zip. Is that
coming from another parent or a profile? Or later in the assembly.xml
file? Or elsewhere in the same pom file, and you just didn't send it?

> I don't have any concept of a profile right now, but I want right now to
> simply suppress the creation of all the extra build artifacts.  Is there a
> way to do that?

Try "mvn help:effective-pom" in your project dir to see the actual pom
as interpreted by Maven.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Skipping the TAR packaging step

jackett_dad
Wayne,

Thanks for the reply.

I am the resident expert with Maven, so I am the only help I have.  If we had someone like you are describing, I would very happy indeed.  So far though, things are looking good, but it's like walking through the dark with a flashlight.

As for the other formats, I'm not looking to get rid of them forever, only in the iterative development cycle where I compile, deploy and test upwards to 20 times a day.  The jar is all I need in this situation.

The old build was done exclusively with Ant.  

My guess about why I'm generating so many different deployment artifacts is that it is due to the assembly plugin in my project pom:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven.assembly.plugin.version}</version>
                <executions>
                    <execution>
                        <id>create-project-bundle</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptorRefs>
                                <descriptorRef>project</descriptorRef>
                            </descriptorRefs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Is there a way to configure this to only generate the jar?  If I am to use the shade plugin, how do I configure it to indicate the suppression I'm looking for?  I read the usage page for both plugins but haven't found what I'm looking for (though I admit I could easily have missed it).

Thanks,

Scott



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Skipping the TAR packaging step

Guillaume Polet-3
Hi,

from what you provide us, I think that you are using the predefined
descriptor 'project' of maven assembly plugin which produces by default
a zip, a tar.gz and a tar.bz2 file
(http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html).
Now, if you want a single big fat jar containing all the classes, just
switch to the descriptor 'jar-with-dependencies' which will unpack all
the jar you depend on and recreate a big jar file containing all the
unpacked classes, plus, the ones of your current project.

Now, if you want to keep those three files (zip, tar.gz and tar.bz2) but
you want to have 2 different kind of builds:
* one that produces the jar file of the current project
* one that produces everything as now
You have two options:
1) you create 2 profiles, one that contains the maven assembly plugin
and another one without it.
2) you bind the assembly plugin to a phase which is after the phase
"package" (for example, "verify"), and in the first case you only call
'mvn package' and the second one you call 'mvn verify'

If what you want is to have a build with:
* one that produces the big fat jar file
* one that produces everything as now
Your only choice is to use profile and configure the maven assembly
plugin differently in each profile.

If you look for information on profiles, go here:
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
If you look for information on lifecylce, phases, etc..., go here:
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

Be careful with profiles because, as mentioned on the maven site, there
are several pitfalls to profiles.

Cheers,
Guillaume

Le 18/01/2012 12:52, jackett_dad a écrit :

> Wayne,
>
> Thanks for the reply.
>
> I am the resident expert with Maven, so I am the only help I have.  If we
> had someone like you are describing, I would very happy indeed.  So far
> though, things are looking good, but it's like walking through the dark with
> a flashlight.
>
> As for the other formats, I'm not looking to get rid of them forever, only
> in the iterative development cycle where I compile, deploy and test upwards
> to 20 times a day.  The jar is all I need in this situation.
>
> The old build was done exclusively with Ant.
>
> My guess about why I'm generating so many different deployment artifacts is
> that it is due to the assembly plugin in my project pom:
>
>              <plugin>
>                  <groupId>org.apache.maven.plugins</groupId>
>                  <artifactId>maven-assembly-plugin</artifactId>
>                  <version>${maven.assembly.plugin.version}</version>
>                  <executions>
>                      <execution>
>                          <id>create-project-bundle</id>
>                          <phase>package</phase>
>                          <goals>
>                              <goal>single</goal>
>                          </goals>
>                          <configuration>
>                              <descriptorRefs>
>                                  <descriptorRef>project</descriptorRef>
>                              </descriptorRefs>
>                          </configuration>
>                      </execution>
>                  </executions>
>              </plugin>
>
> Is there a way to configure this to only generate the jar?  If I am to use
> the shade plugin, how do I configure it to indicate the suppression I'm
> looking for?  I read the usage page for both plugins but haven't found what
> I'm looking for (though I admit I could easily have missed it).
>
> Thanks,
>
> Scott
>
>
>
>
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Skipping-the-TAR-packaging-step-tp5152958p5154628.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Skipping the TAR packaging step

jackett_dad
Thanks, Guillaume.  I'll read through the links you've provided carefully to see if I can make this happen.

Scott
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Skipping the TAR packaging step

Ron Wheeler
In reply to this post by jackett_dad
You will probably get a big improvement by breaking your project into
smaller functional modules (Think SOA) that are more stable and do not
have to be compiled for every change.
They just become dependencies in the higher level modules and are
brought in automatically by maven as required.

Ron

On 17/01/2012 4:29 PM, jackett_dad wrote:

> Hello,
>
> I'm working on a large project that takes time to compile.  I would like to
> instruct Maven to only build the jar file, but after the build I have a tar,
> tar.bz2, and a zip file.  I am brand new to Maven, but have converted a
> project to use Maven for the compilation of all component modules.  In
> general, I want to indicate to Maven to only create me a jar with all
> dependencies rolled into that jar, and nothing else.  This can be for a
> particular profile, one for specific for development.  The wait is too long
> when I make a small change.
>
> So I have a parent pom that is the kind that aggregates all sub-modules.  In
> any given module that I want to generate an executable jar for, I have a
> section that looks like this:
>
>      <build>
>          <plugins>
>              <plugin>
>                  <artifactId>maven-assembly-plugin</artifactId>
>                  <version>${maven.assembly.plugin.version}</version>
>
>                  <configuration>
>                      <descriptors>
>
> <descriptor>../config/maven/single-jar-assembly.xml</descriptor>
>                      </descriptors>
>                      <archive>
>                          <manifest>
>                              <mainClass>com.company.MainClass</mainClass>
>                          </manifest>
>                      </archive>
>                  </configuration>
>              </plugin>
>          </plugins>
>      </build>
>
> The assembly starts like this:
>
> <assembly
> xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
> http://maven.apache.org/xsd/assembly-1.1.2.xsd">
>      <id>all</id>
>      <formats>
>          <format>jar</format>
>      </formats>
>      <includeBaseDirectory>false</includeBaseDirectory>
>
> I don't have any concept of a profile right now, but I want right now to
> simply suppress the creation of all the extra build artifacts.  Is there a
> way to do that?
>
> Sorry if it's been asked before, but I have either not found it, or when I
> did find it, I didn't understand what needed to be done.  I barely eked out
> the assembly.xml that I did create.
>
> Thanks for any help you can provide,
>
> Scott
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Skipping-the-TAR-packaging-step-tp5152958p5152958.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Ron Wheeler
President
Artifact Software Inc
email: [hidden email]
skype: ronaldmwheeler
phone: 866-970-2435, ext 102




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Skipping the TAR packaging step

jackett_dad
Right now the entire project is being refactored, so I don't have much of a choice right now.
Loading...