[ https://issues.apache.org/jira/browse/SOLR-1888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hoss Man updated SOLR-1888: --------------------------- Fix Version/s: (was: 4.0) removing fixVersion=4.0 since there is no evidence that anyone is currently working on this issue. (this can certainly be revisited if volunteers step forward) > Annotated beans source generation with maven plugin > --------------------------------------------------- > > Key: SOLR-1888 > URL: https://issues.apache.org/jira/browse/SOLR-1888 > Project: Solr > Issue Type: New Feature > Affects Versions: 1.5 > Environment: java, maven > Reporter: Matthias Epheser > Attachments: maven-solr-plugin.zip > > > As I stumbled over a lot of copy pasting while creating java annotated beans > representing a schema.xml, i decided to make a shortcut and create a maven > plugin. > Think about it as source generation similar to castor/jaxb code generation > from an xsd. You just point to a schema.xml and connect to the > generate-sources phase. This leads to a java bean in > target/generated-sources/solr that contains all fields from the schema well > annotated. > The mapping reads the <fields> section and maps field="string" to > solr.StringField to java.lang String etc. Multivalured fields generate lists, > dynamic fields Maps. Currently the code generation is plain simple, just a > fileWriter with some intends. The getValidJavaName(String name) may act more > professional than now. > Just install the plugin contained in the zip using mvn install and connect it > to an existing solrj project: > {{ > <plugin> > <groupId>org.apache.solr</groupId> > <artifactId>maven-solr-plugin</artifactId> > <configuration> > <schemaFile>test-data/solr/conf/schema.xml</schemaFile> > <qualifiedName>org.test.MyBean</qualifiedName> > </configuration> > <executions> > <execution> > <phase>generate-sources</phase> > <goals> > <goal>generate</goal> > </goals> > </execution> > </executions> > </plugin> > }} > The generated fiels will be automatically added to the classpath after the > first run of mvn generate/compile. So just execute mvn eclipse:eclipse once > after that. After every change in the schema, generate again and your bean > will be updated and fields and getters and setters will be present. > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org