FYI, I finally changed my mind and went for the simple path by just adding another property having the same format that the one for m-compiler-p/target.
Just say for example "1.6" to the enforcer rule and it will fail if some bytecode higher than for 1.6 target if found in some of the dependencies. Cheers 2013/2/10 Baptiste MATHUS <bmat...@batmat.net> > Good point. I actually haven't thought about it, since I never used it. > > After adding a dependency on toolchain, we can retrieve the > ToolChainManager through getComponent(ToolchainManager.ROLE) for example. > > So the order could be: > 1/ if a param is specified on the enforcer rule itself, use it, else > 2/ if toolchains is used, then use it (as it is in m-compiler-p), else > 3/ back on my initial question: how to retrieve the target JDK specified > [and there's actually a step between: if executable param is specified on > m-compiler-p, then it doesn't use toolchains, what should be done then in > the enforcer rule]? > > WDYT? > > Thanks > > > 2013/2/9 Stephen Connolly <stephen.alan.conno...@gmail.com> > >> How will it interact with tool chains? >> >> >> On Saturday, 9 February 2013, Baptiste Mathus wrote: >> >>> Hi all, >>> >>> I'm thinking about improving the newly created >>> EnforceBytecodeVersion<http://svn.codehaus.org/mojo/trunk/mojo/extra-enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EnforceBytecodeVersion.java>in >>> extra-enforcer-rules by automatically detecting the target JDK and >>> forbidding any higher version of bytecode used in the dependencies. >>> This would still be possible to force bytecode target, but the parameter >>> would become optional. >>> >>> So, sorry if this is a dumb question, but I'd like to retrieve the maven >>> compiler target >>> version<http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#target>, >>> but I seem to remember I read somewhere that's a bad practice for a plugin >>> to read another one's config. >>> >>> So : >>> >>> - Does this addon sound like a good thing to you, or am I missing >>> something? >>> - How should I proceed to do it the right way® ? >>> >>> >>> Thanks a lot. >>> >>> -- >>> Baptiste >>> >> > > > -- > Baptiste <Batmat> MATHUS - http://batmat.net > Sauvez un arbre, > Mangez un castor ! > > -- > Baptiste <Batmat> MATHUS - http://batmat.net > Sauvez un arbre, > Mangez un castor ! nbsp;! >