[
https://issues.apache.org/jira/browse/JENA-596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Shane StClair updated JENA-596:
-------------------------------
Attachment: jena-maven-tools.patch
The attached patch builds with both pre and post 3.1X Maven.
Apparenty in 3.1X Maven changed the library they use to handle parameter
setting. The new system specifically ignores static variables [1], which is why
it couldn't find SchemagenMojo's projectBuildDir to set.
While I was working this out I also made some other changes. The javadoc
generating plugin was complaining about not understanding the Maven plugin
annotations like @mojo and @parameter. Adding the Maven plugin taglet library
didn't help either, since it only allows @parameter on fields and not setter
methods (although the Maven docs themselves say that both are legal). I
switched to using the more modern and compiler visible Java annotations, but
the same problem remained; @Parameter Java annotations are only allowed on
fields and not setters. I opened a bug but I wouldn't count on it getting
resolved right away [1].
To allow the use of Java annotations, I removed the Source class from
SchemagenOptions' hierarchy and made it a standalone, dumb container class
whose only purpose is to hold the Maven configuration. SchemagenOptions now
accepts a Source object in its constructor, and configures itself with the
Source object if its availaible.
To avoid having to manually call SchemagenOptions' setOption for every Source
property, I made a SchemagenOption annotation that is placed on Source getters
and indicates which schemagen.OPT the Source property should be used to set.
During SchemagenOption construction, Java reflection is used to loop through
Source's getter methods, look for a SchemagenOption annotation, and call
setOption with the getter value is it's not null.
To me this separates the concerns of getting the configuration options from
Maven and setting the configuration options for schemagen, and more importantly
allows the use of Java annotations.
All the tests have been adjusted and are passing. The one exception is
SourceTest's testSetInput2, which formerly set input twice and expected both
values to be present in SchemagenOptions. Apparently schemagen itself can
handle multiple inputs (?), but it doesn't appear that the SchemagenMojo itself
supports multiple inputs so I added an @Ignore to this test. If we want
multiple inputs to be supported, I believe that Source would need to have a
List<String> for input, SchemagenMojo would need an adjustment in handleOption,
etc.
[1]
https://github.com/eclipse/sisu.plexus/blob/master/org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/CompositeBeanHelper.java#L329
[2] http://jira.codehaus.org/browse/MPLUGIN-254
> Schemagen does not work with Maven 3.1.x
> ----------------------------------------
>
> Key: JENA-596
> URL: https://issues.apache.org/jira/browse/JENA-596
> Project: Apache Jena
> Issue Type: Bug
> Reporter: Ian Dickinson
> Assignee: Ian Dickinson
> Attachments: jena-maven-tools.patch
>
>
> Maven 3.1.x has changed the way that POM parameters are passed to plugin
> code, causing the schemagen Maven plugin to break.
--
This message was sent by Atlassian JIRA
(v6.1#6144)