My current project has 319 Maven POMs. These have been worked upon by at least five 'generations' of coders, that is under five different software engineering leads. Maven enables different actions depending upon different profiles. This seems like a good idea: you want a new behavior, the work you are doing is new to you and maybe to the project. Name your profile and get the thing you want done. Lets see how that work out over ten years. |
find * -name pom.xml | grep -v git |grep -v target \
|xargs grep -h -a1 "<profile>" \
|grep "<id>" |tr -d '[ \t]'| \
sed 's/<[\/]*id>//g'| \
sort |uniq -c
2 code-quality
5 component-test
64 full
1 Full
5 im-elasticsearch
1 it-test
1 it-tests
1 local-it-tests
28 nightly
1 owasp
8 unit
- 2 code-quality
-
seems like you want to separate out your Sonar run, maybe combine it with another profile, say security checking, and want the luxury to only run one at a time.
Use full - 5 component-test
-
wat? Is this an integration test or a unit test?
Use full - 64 full
-
short and to the point
Winner! - 1 Full
-
Typo
Use full - 5 im-elasticsearch
-
Might have been a candidate, if inheritted and there was a need for mix-ins, but neither holds.
Requires component-test
Use full - 1 it-test
-
Should be plural.
Use full - 1 it-tests
-
IT stands for Integration Test so it-tests is Integration Test Tests.
Use full - 1 local-it-tests
-
Integration tests which are not run on the Continuous Integration server? Wrong.
Use full - 28 nightly
-
These presumably still need to be run on any change. Control periodicity in the Continuous Integration server configuration.
Use full - 1 owasp
-
What are these? Why are they special snowflakes? OWASP tests need to be run on any change.
Use full - 8 unit
-
Unit tests are the default profile.
Delete
Using multiple profiles is a bad idea.
Unit tests should be run in any scenario, and should be run as part of development.
A reasonable distinction between tests is those which require external fixtures off the developers machine and those which do not, or those that take a long time to run, disabling the developer's machine. Some tests attempt to drain resources from the machine they are running on, not great on the developer's machine. There is no inherent advantage to calling out these motivations in the profile name.
What we want is to be able to reason about the whole class, to be able to say true things about all our builds. This is a much greater advantage than an attempt to communiate with other developers through naming.
Use full
Now we know that we have three types of build:
- no tests
- -Dmaven.test.skip=true
(preferred over -skipTests) - unit tests
- Default profile, nothing for you to do.
- all tests
- -Pfull
We can happily say that the only thing to do when writing code to build our code is to use the profile full.
Variety is sand in the gears of our development machine, however much it may mean to you is wears away at your precious attention.