You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by kenduron <ke...@web.de> on 2012/10/19 10:15:20 UTC

Maven and special building behaviour

Hello,

perhaps you can help me.

I got a WAR (web archive) which is built with maven.
It works perfectly.

mvn clean package install

But from now on, I need to create and additional special version of this war 
from the same code base. In this special version, some modification will be done:

- some classes are removed from the war (indeed controller classes)
- a configuration file is changed

the special version is a limited version of the normal version.

It should be deployed with a special tag, e.g.

MyWar - Version 1.0.0 - specialEdition.

Is this possible with maven?
If so, how?

Branching in svn is overwhelming

Thanks you

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


Re: Maven and special building behaviour

Posted by Ron Wheeler <rw...@artifact-software.com>.
Maven can do damn near anything. That does not mean that it should.

The first advice was right.
Split MyJar to remove the classes to make a MyJar-common of all the 
classes that you always want.
Make MyJar-common a dependency of a smaller MyJar that only has the 3 
classes.
Make your other jars depend on the either MyJar-common (war) of the new 
MyJar which has all the classes(mostly by dependency)

That is the "Maven Way". You and Maven will remain friends if you do this.
It may also be easier to maintain as your project grows since it starts 
you down the road to smaller more functionally-oriented projects that 
are more stable in the same way that functional design at the code level 
helps make software more robust and reduces the scope of maintenance 
activity.

Other ways to make your end-result happen will piss-off Maven and get 
you into a war of attrition which you will eventually give up on and go 
back to the advice that you got, in order to restore your relationship 
with Maven.

"Resistance is futile".

Ron


On 19/10/2012 9:04 AM, kenduron wrote:
> Am 19.10.2012 14:32, schrieb Thomas Sundberg:
>> On 19 October 2012 10:15, kenduron <ke...@web.de> wrote:
>>> Hello,
>>>
>>> perhaps you can help me.
>>>
>>> I got a WAR (web archive) which is built with maven.
>>> It works perfectly.
>>>
>>> mvn clean package install
>>>
>>> But from now on, I need to create and additional special version of 
>>> this war
>>> from the same code base. In this special version, some modification 
>>> will be
>>> done:
>>>
>>> - some classes are removed from the war (indeed controller classes)
>>> - a configuration file is changed
>>>
>>> the special version is a limited version of the normal version.
>>>
>>> It should be deployed with a special tag, e.g.
>>>
>>> MyWar - Version 1.0.0 - specialEdition.
>>
>> Probably not, it should be deployed with a specific name that differs
>> it from the normal artifact. Not a special tag.
>>
>>>
>>> Is this possible with maven?
>>
>> Yes
>>
>>> If so, how?
>>
>> You divide your project in different modules. Everything common should
>> be in a common module, anything specific should be in a specific
>> module. Typically one module per artifact.
>>
>> The common module should create a jar that the specific modules 
>> depends on.
>> These specific modules should all depend om the common module, add
>> it's specific difference and finally produce a war as deployable
>> artifact.
>>
>> This would be the Maven way. Common things in one module, specific
>> things in specific modules.
>
> Thank you, but maybe you got it wrong.
> My Project is already separated in the following way
>
> MyJar.jar
> MyWar.war
> MyEear.ear
>
> During the build of the war, some 3 class files should be removed, 
> like this
>
> del src/main/java/.../controller/SpecialAdmin1Controller.java
> del src/main/java/.../controller/SpecialAdmin2Controller.java
> del src/main/java/.../controller/SpecialAdmin3Controller.java
>
> Can this done with maven without separating?
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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


Re: Maven and special building behaviour

Posted by kenduron <ke...@web.de>.
Am 19.10.2012 14:32, schrieb Thomas Sundberg:
> On 19 October 2012 10:15, kenduron <ke...@web.de> wrote:
>> Hello,
>>
>> perhaps you can help me.
>>
>> I got a WAR (web archive) which is built with maven.
>> It works perfectly.
>>
>> mvn clean package install
>>
>> But from now on, I need to create and additional special version of this war
>> from the same code base. In this special version, some modification will be
>> done:
>>
>> - some classes are removed from the war (indeed controller classes)
>> - a configuration file is changed
>>
>> the special version is a limited version of the normal version.
>>
>> It should be deployed with a special tag, e.g.
>>
>> MyWar - Version 1.0.0 - specialEdition.
>
> Probably not, it should be deployed with a specific name that differs
> it from the normal artifact. Not a special tag.
>
>>
>> Is this possible with maven?
>
> Yes
>
>> If so, how?
>
> You divide your project in different modules. Everything common should
> be in a common module, anything specific should be in a specific
> module. Typically one module per artifact.
>
> The common module should create a jar that the specific modules depends on.
> These specific modules should all depend om the common module, add
> it's specific difference and finally produce a war as deployable
> artifact.
>
> This would be the Maven way. Common things in one module, specific
> things in specific modules.

Thank you, but maybe you got it wrong.
My Project is already separated in the following way

MyJar.jar
MyWar.war
MyEear.ear

During the build of the war, some 3 class files should be removed, like this

del src/main/java/.../controller/SpecialAdmin1Controller.java
del src/main/java/.../controller/SpecialAdmin2Controller.java
del src/main/java/.../controller/SpecialAdmin3Controller.java

Can this done with maven without separating?




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


Re: Maven and special building behaviour

Posted by Thomas Sundberg <ts...@kth.se>.
On 19 October 2012 10:15, kenduron <ke...@web.de> wrote:
> Hello,
>
> perhaps you can help me.
>
> I got a WAR (web archive) which is built with maven.
> It works perfectly.
>
> mvn clean package install
>
> But from now on, I need to create and additional special version of this war
> from the same code base. In this special version, some modification will be
> done:
>
> - some classes are removed from the war (indeed controller classes)
> - a configuration file is changed
>
> the special version is a limited version of the normal version.
>
> It should be deployed with a special tag, e.g.
>
> MyWar - Version 1.0.0 - specialEdition.

Probably not, it should be deployed with a specific name that differs
it from the normal artifact. Not a special tag.

>
> Is this possible with maven?

Yes

> If so, how?

You divide your project in different modules. Everything common should
be in a common module, anything specific should be in a specific
module. Typically one module per artifact.

The common module should create a jar that the specific modules depends on.
These specific modules should all depend om the common module, add
it's specific difference and finally produce a war as deployable
artifact.

This would be the Maven way. Common things in one module, specific
things in specific modules.

>
> Branching in svn is overwhelming

Branching my be the root of all evil. Avoid if possible.




HTH
Thomas



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



-- 
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg

Better software through faster feedback

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