maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anders Hammar <and...@hammar.net>
Subject Re: Copying different property files based on a Profile
Date Wed, 17 Feb 2010 12:51:33 GMT
GAV is groupId, artifactId and version. The three main coordinates in Maven.

You use classifiers in a project. It doesn't matter if that project is a
module in a multi-module project. However, you need to do some configuration
to get the secondary artifacts attached to your project.

Btw, my view of how to handle environment specific configuration in general
is to keep it outside of your archive. IMO, what you should od is read the
properties (or whatever) from the classpath and then on deployment make sure
the correct file is on the classpath. This enables you to test the EXACT
same archive that you will deploy later on. If you have three different
archives (one for each environment) you could run into issues due to
differences in the archives.

/Anders

On Wed, Feb 17, 2010 at 13:45, sehgal.prithvi
<java.programmer14@gmail.com>wrote:

>
> Hello Anders,
> Thanks again.
> So by using classifiers, if i am using a multi module project, even then
> whole project will be having one single POM? Is it possible in case of a
> project
> which is using modules?
>
> What is a GAV anders? Sorry it's a dumb question but i am not very well
> acquainted with the
> buzzwords currently. :)
>
> Yes i will have a look at classifiers now and will get back to you with my
> feedback.
>
> Cheers,
> Prithvi
>
>
>
>
>
>
> Anders Hammar wrote:
> >
> > 1) Well, They easiest explanation is that you would then end up with
> three
> > different artifacts with the same GAV which actually are three different
> > artifacts. That breaks one of the basic rules about coordinates of unique
> > artifacts in Maven. The other, more subtle, is that you should only have
> > to
> > execute one build to get all your artifacts. You shouldn't have to build
> > your project three times.
> >
> > 2) Have a look at classifiers. There is always just one primary artifact
> > (no
> > classifier) of a project, but you could add extra artifacts with
> > classifiers. However, do understand that using classifiers incorrectly
> and
> > not understanding the limitations will break dependency management in
> > Maven.
> > I.e., there is just one pom for a project, so all artifacts (primary and
> > secondary) will have the same dependencies.
> >
> > /Anders
> >
> > On Wed, Feb 17, 2010 at 13:30, sehgal.prithvi
> > <java.programmer14@gmail.com>wrote:
> >
> >>
> >> Hello Anders,
> >> Thanks for such a prompt response. I have two queries in mind after
> >> reading
> >> your answer.
> >>
> >> 1- Why ain't it good to have project which make different builds?
> >> Typically
> >> even
> >> if we use ANT, we have one build file responsible for generating
> >> different
> >> archives
> >> based on the environment?
> >>
> >> 2- Can you tell me what did you exactly mean to have on primary artifact
> >> and two secondary artifacts with classifiers? I am totally new to maven,
> >> so
> >> can you tell me a bit about it?
> >>
> >> Thanks,
> >> Prithvi
> >>
> >>
> >> Anders Hammar wrote:
> >> >
> >> > Having profiles determining what should be included in the ear (or any
> >> > other
> >> > archive for that matter) is not good practice. You should only do one
> >> > build
> >> > that creates all that you need. If you have profiles, you will
> >> typically
> >> > run
> >> > one build for each profile. Not good.
> >> > A better approach is to have, in your case, three different projects,
> >> each
> >> > building the ear for a specific environment.
> >> > Or, you could have one project with a primary artifact and two
> >> secondary
> >> > artifacts (with classifiers). I don't like classifiers so I wouldn't
> do
> >> > that, but it ios possible.
> >> >
> >> > /Anders
> >> >
> >> > On Wed, Feb 17, 2010 at 11:09, sehgal.prithvi
> >> > <java.programmer14@gmail.com>wrote:
> >> >
> >> >>
> >> >> Dear All,
> >> >>
> >> >> I am new to Maven and i am encountering the following problem at
> hand.
> >> >>
> >> >> I have made a multi-module project. The project eventually has to
> >> build
> >> >> an
> >> >> EAR artifact from a WAR file.
> >> >> We have different properties files for different environments i.e.
> >> >>
> >> >> - Development
> >> >> - Test
> >> >> - Production
> >> >>
> >> >> My resource folder architecture is given as below
> >> >>
> >> >> resources/development/project.properties
> >> >> resources/test/project.properties
> >> >> resources/production/project.properties
> >> >>
> >> >> Now, i have implemented the Profiles approach provided in Maven and
> >> then
> >> >> for
> >> >> copying the resources based on different
> >> >> environments, i was using maven-resources-plugin.
> >> >>
> >> >> The issue is that, i want to exclude the folders production and test
> >> >> completely when my development profile is activated.
> >> >> When the war is made in the classes folder three folders are made
> also
> >> >>
> >> >> classes/development/project.properties
> >> >> classes/production/projection.properties
> >> >> classes/test/project.properties
> >> >>
> >> >> Where as i want something like this
> >> >>
> >> >> classes/project.properties
> >> >>
> >> >> That is referenced in the application-context.xml. Please help me how
> >> can
> >> >> i
> >> >> achieve this effect.
> >> >>
> >> >> Prithvi
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://old.nabble.com/Copying-different-property-files-based-on-a-Profile-tp27621527p27621527.html
> >> >> Sent from the Maven - Users mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> >> For additional commands, e-mail: users-help@maven.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Copying-different-property-files-based-on-a-Profile-tp27621527p27622997.html
> >> Sent from the Maven - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Copying-different-property-files-based-on-a-Profile-tp27621527p27623132.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message