You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Laurent Vaills <la...@yahoo-inc.com> on 2008/03/21 12:02:13 UTC

How to both compile and generate a .tar.gz ?

Hi,

We are moving our build system from ant to maven. 
We have some components that contains some Java classes and some shell
scripts. Our ant-build system compiles the Java classes and then
generates a .tar.gz containing the shell scripts and the Java classes. 
So we now want to do the same with Maven. 

We have started to write our pom.xml by defining the packaging as POM
and by writing an assembly description to produce the tar.gz. Our
problem is that the Java classes are not compiled anymore (because
setting the packaging to pom starts at the pahse "package"). I've tried
to explicitly execute the maven-compiler-plugin to compile the Java
classes but without success.

Any ideas on how to achieve this with Maven ?

Laurent

Re: How to both compile and generate a .tar.gz ?

Posted by Laurent Vaills <la...@yahoo-inc.com>.
On Fri, 2008-03-21 at 12:12 +0100, simon.kitching@chello.at wrote: 
> Laurent Vaills schrieb:
> > Hi,
> >
> > We are moving our build system from ant to maven. 
> > We have some components that contains some Java classes and some shell
> > scripts. Our ant-build system compiles the Java classes and then
> > generates a .tar.gz containing the shell scripts and the Java classes. 
> > So we now want to do the same with Maven. 
> >
> > We have started to write our pom.xml by defining the packaging as POM
> > and by writing an assembly description to produce the tar.gz. Our
> > problem is that the Java classes are not compiled anymore (because
> > setting the packaging to pom starts at the pahse "package"). I've tried
> > to explicitly execute the maven-compiler-plugin to compile the Java
> > classes but without success.
> >
> > Any ideas on how to achieve this with Maven ?
> >   
> 
> For a normal (simple) project, you just have a single pom with
> packaging=jar (which is the default). This will of course compile the
> classes and build a jarfile. Then you can just add the
> maven-assembly-plugin as a plugin in the build section. This plugin can
> be configured to build zip or tgz files from the classes/jarfile plus
> files checked in elsewhere (eg under src/scripts for your shellscripts).
> 
> In a more complex case, you may want to split the java code up into
> seperate maven modules, each with their own pom. Then you can declare a
> separate module with packaging=pom which declares dependencies on your
> other modules. The maven-dependency-plugin can then download all the
> deps into a directory for the maven-assembly-plugin to work with.
> 
> Regards,
> Simon

Hi Simon, 

Thanks for your answer.
I also thought about the multi-module but that's more difficult to
implement for us. 

In fact I think we addressed the problem in the wrong : instead of
adding the compilation to a pom packaging, just add a custom packaging
to a jar packaging :) I'll try to do it that way.

Laurent



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


Re: How to both compile and generate a .tar.gz ?

Posted by "simon.kitching@chello.at" <si...@chello.at>.
Laurent Vaills schrieb:
> Hi,
>
> We are moving our build system from ant to maven. 
> We have some components that contains some Java classes and some shell
> scripts. Our ant-build system compiles the Java classes and then
> generates a .tar.gz containing the shell scripts and the Java classes. 
> So we now want to do the same with Maven. 
>
> We have started to write our pom.xml by defining the packaging as POM
> and by writing an assembly description to produce the tar.gz. Our
> problem is that the Java classes are not compiled anymore (because
> setting the packaging to pom starts at the pahse "package"). I've tried
> to explicitly execute the maven-compiler-plugin to compile the Java
> classes but without success.
>
> Any ideas on how to achieve this with Maven ?
>   

For a normal (simple) project, you just have a single pom with
packaging=jar (which is the default). This will of course compile the
classes and build a jarfile. Then you can just add the
maven-assembly-plugin as a plugin in the build section. This plugin can
be configured to build zip or tgz files from the classes/jarfile plus
files checked in elsewhere (eg under src/scripts for your shellscripts).

In a more complex case, you may want to split the java code up into
seperate maven modules, each with their own pom. Then you can declare a
separate module with packaging=pom which declares dependencies on your
other modules. The maven-dependency-plugin can then download all the
deps into a directory for the maven-assembly-plugin to work with.

Regards,
Simon


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