You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jon Paynter <ki...@gmail.com> on 2010/09/23 19:51:47 UTC
Creating an install directory
Hi,
Im working with a multi-module project and trying to create an install
directory. The directory will eventually be copied to a destination server
(or servers depending on configs).
Ive been working with the assembly and dependency copy plugins to try and
get things copied into their proper places into the install folder.
I want to endup with a structure like so:
top level pom.xml
/Release/dev/
/Release/qa/
/Release/prod/
And then all the projects in their respective subdirectories.
The project has 2 types of components: regular jar, and j2ee. For the
regular jar components, I want the jar file to in the root of its respective
environment. For the j2ee components, I want the jar, ear and rar, and misc
config files to be placed in a folder with the same name as the j2ee
component.
>From what ive read in the documentation, this seems to be a job for both the
dependancy and assembly plugins. I found this in the docs:
http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html
In particular "The dependency:copy goal can also be used to copy the just
built artifact to a custom location" so I added that to my top level POM,
and setup the paths to copy to /Release/<envType>. That works just fine.
But the problem is trying to get the output of my assembly to be copied as a
dependency. I setup an assembly to create a zip file for my j2ee component
and that works. I also setup the build-helper pugin to attach the generated
zip file to the packaging project for my j2ee component, and it gets
installed into my local repository just fine. But now I need to get the
zip file copied to my install directory and unpacked.
How do i do that?
Then once that is solved, I want the whole install directory to be zipped up
and installed into the repository so we can get retreive it at any time.
And lastly - this is more of an annoyance factor: When I used the
dependency plugin to copy the just built artifacts, it tried to copy the pom
only projects and failed. in order to fix that, I moved the dependency copy
to the install phase instead of the package phase. Im worried this may
cause other problems in the future. Is there a way to exclude certian
categories of things from the dependency copy?
Ideas and suggestions are welcome,
Jon.
Re: Creating an install directory
Posted by Jon Paynter <ki...@gmail.com>.
yes thats definately possible to.
however thats what im trying to move away from. The current build is a
morass of ant scripts for building and packaging. doing bugfixes and updates
is problematic at best.
based on what ive been able to accomplish it seems im close to a solution,
but with only 1 or 2 missing pieces to get everything to fall in place
nicely.
On Thu, Sep 23, 2010 at 11:50 AM, D D <da...@gmail.com> wrote:
> Hi Jon,
>
> First of all I'm not an expert but maybe experts will correct my advise.
>
> In essence I would not "bend" Maven to do all that distribution for you. If
> possible I would suggest to use dependency:copy to move artifacts to some
> other location and then write a script to sort them according to your
> needs.
>
> I had similar dilemma a while back and decided that scripting was whole lot
> easier then writing elaborate and customized pom files.
>
> Hope it helps!
>
> Thanks,
> Dave
>
> On Thu, Sep 23, 2010 at 12:51 PM, Jon Paynter <ki...@gmail.com> wrote:
>
> > Hi,
> >
> > Im working with a multi-module project and trying to create an install
> > directory. The directory will eventually be copied to a destination
> server
> > (or servers depending on configs).
> >
> > Ive been working with the assembly and dependency copy plugins to try and
> > get things copied into their proper places into the install folder.
> > I want to endup with a structure like so:
> >
> > top level pom.xml
> >
> > /Release/dev/
> > /Release/qa/
> > /Release/prod/
> >
> > And then all the projects in their respective subdirectories.
> >
> > The project has 2 types of components: regular jar, and j2ee. For the
> > regular jar components, I want the jar file to in the root of its
> > respective
> > environment. For the j2ee components, I want the jar, ear and rar, and
> > misc
> > config files to be placed in a folder with the same name as the j2ee
> > component.
> >
> > From what ive read in the documentation, this seems to be a job for both
> > the
> > dependancy and assembly plugins. I found this in the docs:
> >
> >
> http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html
> > In particular "The dependency:copy goal can also be used to copy the just
> > built artifact to a custom location" so I added that to my top level
> POM,
> > and setup the paths to copy to /Release/<envType>. That works just fine.
> >
> > But the problem is trying to get the output of my assembly to be copied
> as
> > a
> > dependency. I setup an assembly to create a zip file for my j2ee
> component
> > and that works. I also setup the build-helper pugin to attach the
> > generated
> > zip file to the packaging project for my j2ee component, and it gets
> > installed into my local repository just fine. But now I need to get the
> > zip file copied to my install directory and unpacked.
> > How do i do that?
> >
> > Then once that is solved, I want the whole install directory to be zipped
> > up
> > and installed into the repository so we can get retreive it at any time.
> >
> >
> > And lastly - this is more of an annoyance factor: When I used the
> > dependency plugin to copy the just built artifacts, it tried to copy the
> > pom
> > only projects and failed. in order to fix that, I moved the dependency
> > copy
> > to the install phase instead of the package phase. Im worried this may
> > cause other problems in the future. Is there a way to exclude certian
> > categories of things from the dependency copy?
> >
> >
> > Ideas and suggestions are welcome,
> > Jon.
> >
>
Re: Creating an install directory
Posted by D D <da...@gmail.com>.
Hi Jon,
First of all I'm not an expert but maybe experts will correct my advise.
In essence I would not "bend" Maven to do all that distribution for you. If
possible I would suggest to use dependency:copy to move artifacts to some
other location and then write a script to sort them according to your needs.
I had similar dilemma a while back and decided that scripting was whole lot
easier then writing elaborate and customized pom files.
Hope it helps!
Thanks,
Dave
On Thu, Sep 23, 2010 at 12:51 PM, Jon Paynter <ki...@gmail.com> wrote:
> Hi,
>
> Im working with a multi-module project and trying to create an install
> directory. The directory will eventually be copied to a destination server
> (or servers depending on configs).
>
> Ive been working with the assembly and dependency copy plugins to try and
> get things copied into their proper places into the install folder.
> I want to endup with a structure like so:
>
> top level pom.xml
>
> /Release/dev/
> /Release/qa/
> /Release/prod/
>
> And then all the projects in their respective subdirectories.
>
> The project has 2 types of components: regular jar, and j2ee. For the
> regular jar components, I want the jar file to in the root of its
> respective
> environment. For the j2ee components, I want the jar, ear and rar, and
> misc
> config files to be placed in a folder with the same name as the j2ee
> component.
>
> From what ive read in the documentation, this seems to be a job for both
> the
> dependancy and assembly plugins. I found this in the docs:
>
> http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html
> In particular "The dependency:copy goal can also be used to copy the just
> built artifact to a custom location" so I added that to my top level POM,
> and setup the paths to copy to /Release/<envType>. That works just fine.
>
> But the problem is trying to get the output of my assembly to be copied as
> a
> dependency. I setup an assembly to create a zip file for my j2ee component
> and that works. I also setup the build-helper pugin to attach the
> generated
> zip file to the packaging project for my j2ee component, and it gets
> installed into my local repository just fine. But now I need to get the
> zip file copied to my install directory and unpacked.
> How do i do that?
>
> Then once that is solved, I want the whole install directory to be zipped
> up
> and installed into the repository so we can get retreive it at any time.
>
>
> And lastly - this is more of an annoyance factor: When I used the
> dependency plugin to copy the just built artifacts, it tried to copy the
> pom
> only projects and failed. in order to fix that, I moved the dependency
> copy
> to the install phase instead of the package phase. Im worried this may
> cause other problems in the future. Is there a way to exclude certian
> categories of things from the dependency copy?
>
>
> Ideas and suggestions are welcome,
> Jon.
>