last day (15 days later) » 

1:32 PM
Continuation of discussion from
1
A: Conditionally exclude some resources in maven from war

blackbuildPlease DON'T use profiles for this. The problem with profiles is that the resulting artifact contains no information about the profiles used to build it. Basic rule: A profile must not change the result of the build. Or the other way around: If you build the same source code revision, the resul...

Saif Asif said "Also, if you use nexus, you can define something similar to regex that actually deploys your artifact if it resembles a certain pattern. E.g I can define regex for XXX-prod.war as my production regex. So any war that is being generated by the production profile will contain prod in its final name and thus get uploaded "
Than you would have to tweak a lot of places to make sure nothing goes wrong.
@LeosLiterak Hi
 
If you are article author, I spotted a mistake: it say that production artifact being deployed to test is risky (because it can delete production data)
it shall be reversed
 
Sorry for the long discussion in your question, but I think using profiles that way (or any other technique)
is deadly
 
I am eager to learn new things correctly
 
on, it is actually correct, this is what happened to a project in another division of a company I was working for.
Which lead me to start my "crusade" against dangerous uses of profiles
 
How many followers on your crusade do you have? :-)
Well, I understand your point how risky it is
but I think it is common. There is a build master / build system that is responsible for creating a build
 
1:40 PM
the Tarballs in that case contained the coordinates of the database.
 
and people in each organization shall know what to use
 
So the Prod tarball was deployed to the test machine. Automated test started and killed a lot of production data, because the worked against the prod database
 
and it is definitively better if filename differs
 
And their was no firewall in place to prevent that
Fortunately, the backups did work
 
pity. Did they use db backups?
 
1:41 PM
yes
 
still lot of work and some data lost
 
BTW: in their case the had a build system in place. But the deployment was done manually
I would advise you to not start precedents and do it right from the start. If you start doing it with your war files, some other developer might do the same (using profiles to change the result) in some jar files.
 
Interesting approach. And we agree on the basic problem. I would however, go one step further and attach all artifacts using different classifiers. That way, you would not need to rely on naming conventions (and you had all your environments in your nexus)
 
I do not use nexus
 
1:54 PM
This is similar to how I did it earlier, but I do not like attached artifacts (using classifiers) that much. Since my projects are heavily modularized anyway, I would rather opt for different modules
No artifact repository at all?
 
Well, maybe we do. I just implemented some application that uses standard dependencies
and I do not need to install it as maven module. It is self contained
Hmm, I ran updated POM like described in blog but META-INF/maven/pom.properties is still the same:
#Generated by Maven
#Tue Apr 15 15:54:11 CEST 2014
version=1.0-SNAPSHOT
groupId=backend
artifactId=acquirer
I hoped that classifier will appear here
 
In that case, your best approach might be the one from Henrik's article. But consider using attached artifacts with classifiers anyway. selfcontained projects tend to not stay that way.
 
What is "attached artifacts with classifiers"
 
They wont change. The coordinates of the project are still the same. Even with classifiers, the classifiers won't be included, so you could only rely on the file name.
 
That is ugly :-(
 
2:00 PM
You can attach additional artifacts to a projects (using mojo.codehaus.org/build-helper-maven-plugin/…). They have a normalized name like my-project-1.2-dev.war
2
i.e. each attached artifact has a different classifier, which is part of the coordinates.
Well, if you don't want it ugly (or not as ugly), divide your project into a multimodule project. That way you can also split webresources from from code, and as an additional benefit, you will have your static resource in another neat package to be deployed separately on Prod.
 
2:18 PM
ok, thanks. I will play with some possibilities for a while
have a nice day
 
you're welcome. Have fun.
Please include the actual solution that you chose in your question.
 

last day (15 days later) »