As no one else has jumped on this, I'd like to pass on some hints/pointers.
They are based on my own experience and also my rule om thumb for Maven
practice.

First, never use the finalName. It will only affect the name of the locally
produced artifact (typically in the target folder). It will not affect the
artifact name in the Maven repo, which is what really matters. So using it
will only give you a false feeling of a solution which will break sooner or
later.

Second, never use profiles. Well, profiles is simply the starting point to
nightmares and very bad Maven solutions. There are many threads on this.
Just stay away of them...:-)

Third, classifiers are typically not something that you should use. There
are some cases where they could be used, but try to stay away from them.

Saying that, I think the solution for you is to have different versions if
you want to differentiate the branches. Could be, for example, 1.0.0
(-SNAPSHOT) for the RC branch and 1.1.0 (-SNAPSHOT) for trunk. I don't
understand the point of having two RC branches though. Are they for the
same release (version) or two different releases? If you, strangely I'd
say, have two RC branches for the same "release" you should add some
postfix to the version. For example 1.0.0 (-SNAPSHOT) and 1.0.0-EXTRACOOL
(-SNAPSHOT).

/Anders

On Thu, Nov 20, 2014 at 12:14 AM, Scott Klein <[email protected]>
wrote:

> Here is our scenario:
>
> We have our SCM trunk and a "release candidate" branch. We merge code into
> the "RC" branch when we want it to go into the next release.
>
> In the past everyone built against the RC branch artifacts. However, now
> we have two release cycles going at the same time and some people want to
> build against the RC branch and others want to build against the trunk. We
> also need to setup servers, etc with the proper artifacts.
>
> So, I think I need to produce two artifacts for each project:
> "project-version.jar" and "project-version-trunk.jar". This, I think is
> simple, I just set the <finalName> in the trunk profile.
>
> Now, how do I use these so that a user building under the "trunk" profile
> will only use artifacts with the new classifier?
>
> We have a parent POM, used everywhere, that defines all of our dependency
> management to insure everyone stays "on version" for all of our
> dependencies. Could I create a property in the "trunk" profile and then use
> that in our dependency  management? For example:
>
> <profile>
>                 <id>trunk</id>
>                 <build>
>
> <finalname>${project.artifactId}-${project.version}-head<finalName>
>                 </build>
>                 <properties>
>                                 <our.classifier>head</our.classifier> <--
> property to use in dependencies
>                 </properties>
>                 ...
> </profile>
>
> <dependencyManagement>
>                 <dependencies>
>                                 <dependency>
>                                                 <groupId>com.ours</groupId>
>
> <artifactId>project1</artifactId>
>
> <version>${project.version}</version>
>
> <classifier>${our.classifier}</classifier> <-- use of the property (if the
> property DNE, or is blank, is that OK?
>                                 </dependency>
>                                 ...
>                 </dependencies>
> </dependencyManagement>
>
>
>
> This is just me using my limited understanding trying to figure out the
> solution - if there is a more appropriate way to do this please let me know
>
>
> Thanks
> scott
>
>

Reply via email to