Skip to content

Add default maven-enforcer configuration#12

Merged
hinerm merged 1 commit intomasterfrom
maven-enforcer
Oct 7, 2014
Merged

Add default maven-enforcer configuration#12
hinerm merged 1 commit intomasterfrom
maven-enforcer

Conversation

@hinerm
Copy link
Copy Markdown
Member

@hinerm hinerm commented Oct 6, 2014

Configures the maven-enforcer plugin to run during each build. Some rules can be disabled if necessary.

@hinerm
Copy link
Copy Markdown
Member Author

hinerm commented Oct 6, 2014

@dscho @ctrueden - are you OK with this direction for the maven-enforcer plugin?

I like separating rules into profiles that are enabled by default, and can then be turned off if desired. I put the rules that conflict with Fiji into the strict-rules profile.

Anything else from the core or extended ruleset you'd like to see?

Should I be more granular in my profile setup, e.g. create several tiers of rules so that different chunks can be disabled or enabled..?

If interested, you can test this by checking on this branch, installing it to your local repo, and changing a scijava project (e.g. scijava-common) to use the 3.7-SNAPSHOT parent pom. If you build the project, it will then fail (because it has a SNAPSHOT dependency). If you build again with mvn -P \!strict-rules it should pass.

@ctrueden
Copy link
Copy Markdown
Member

ctrueden commented Oct 6, 2014

Should I be more granular in my profile setup

For now I think not. Let's just have two levels: strict and loose. More than that starts being too complex, unless there is a specific need for it.

@ctrueden
Copy link
Copy Markdown
Member

ctrueden commented Oct 6, 2014

Anything else from the core or extended ruleset you'd like to see?

Definitely:

  • requirePluginVersions - This is the most important one. Without it, builds are not reproducible. So just like release version dependencies, we need to require specific pinned plugin versions of all used plugins.
  • requireMavenVersion - and matching the minimum defined in the <prerequisites> section, maybe using a property.
  • requirePrerequisites - needed, since the <prerequisites> section is not inherited, apparently.

@hinerm
Copy link
Copy Markdown
Member Author

hinerm commented Oct 6, 2014

@ctrueden I believe I addressed everything.. see anything you don't like?

@ctrueden
Copy link
Copy Markdown
Member

ctrueden commented Oct 6, 2014

Thanks Mark! Looks awesome! I wrote one whitespace nitpick, and otherwise I am totally happy with it!

Adds configuration specification for the maven-enforcer plugin and a
default binding to the validate lifecycle phase. This will cause the
maven-enforcer:enforce target to be run at the start of each maven
build, using whichever rules are active.

As configured, these rules are always on:
* enforceBytecodeVersion
* banCircularDependencies

These rules are on by default but can be disabled by setting the system
property: scijava.enforce.skip:
* requireReleaseDebs
* banDuplicateClasses
* requireMavenVersion
* requirePrerequisites
* requireReleaseDeps

As some of these properties may use maven and jvm versions, these have
been converted to their own properties.
hinerm added a commit that referenced this pull request Oct 7, 2014
Enables the maven-enforcer plugin by default. Rules are separated into two categories: "loose" that are always on, and "strict" that are on when scijava.enforce.skip is not set. This allows us to disable certain rules, for example when we are building development versions of code.
@hinerm hinerm merged commit 3fd47e1 into master Oct 7, 2014
@dscho dscho deleted the maven-enforcer branch October 7, 2014 12:34
@dscho
Copy link
Copy Markdown
Contributor

dscho commented Oct 7, 2014

FWIW I think that we should never, ever use the non-strict mode. Since switching to the release coupling strategy (in particular for pom-fiji), it is no problem to bump the parent POM version only when the enforcer passes in strict mode.

@hinerm
Copy link
Copy Markdown
Member Author

hinerm commented Oct 7, 2014

@dscho I agree that we should only release things that pass the strict mode. But this configuration causes enforcer:enforce to run in every maven build.. if we ever want to develop against SNAPSHOTs, non-strict mode gives an easy way to build locally first.

@dscho
Copy link
Copy Markdown
Contributor

dscho commented Oct 7, 2014

if we ever want to develop against SNAPSHOTs, non-strict mode gives an easy way to build locally first.

But would enforcer really require all dependencies of a SNAPSHOT to be on release versions? I thought that would only be enforced for release versions, not SNAPSHOT versions, of the artifact to build...?

@ctrueden
Copy link
Copy Markdown
Member

ctrueden commented Oct 7, 2014

But would enforcer really require all dependencies of a SNAPSHOT to be on release versions?

@dscho I would be very surprised if that rule didn't apply to SNAPSHOT builds. After all: we ourselves want all dependencies to be releases, always, except when developing topic branches which we plan to rewrite before merging.

@hinerm
Copy link
Copy Markdown
Member Author

hinerm commented Oct 7, 2014

But would enforcer really require all dependencies of a SNAPSHOT to be on release versions?

Yup. Enforcer doesn't care. If you take the current master of SJC and change its parent to pom-scijava 3.7-SNAPSHOT, it will not build without -Dscijava.enforce.skip because it now contains a SNAPSHOT parent. Even though its version itself is a SNAPSHOT.

@dscho
Copy link
Copy Markdown
Contributor

dscho commented Oct 7, 2014

Okay, okay. I slouch corrected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants