Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make code generation part of Maven lifecycle #257

Open
xasx opened this issue Aug 15, 2016 · 3 comments
Open

Make code generation part of Maven lifecycle #257

xasx opened this issue Aug 15, 2016 · 3 comments

Comments

@xasx
Copy link

xasx commented Aug 15, 2016

Just a proposal:

You can make use of several maven plugins to eliminate the need of executing the generate.sh prior to the actual Maven build.

There are several plugins out there:

After generation, you would tell Maven to respect the sources from the generated directory via the build-helper-maven-plugin - http://www.mojohaus.org/build-helper-maven-plugin/usage.html

@lookfirst
Copy link
Owner

Seems like a sane proposal. Not sure if we hacked the generated code or not. =( That might have to be factored into this.

@dankarp
Copy link
Collaborator

dankarp commented Aug 19, 2016

I got a ways towards un-hacking the generated code a while back. I'll see if I can find it.

@adammichalik
Copy link

I had a look at this and the following configuration in pom.xml generates the JAXB classes that match those in the src/main/java/com/github/sardine/model. The differences that I spotted are:

  • custom SimplePrivilege interface and its usages
  • the Maven plugin generates the fields as protected and not private (apparently hard to get around it without an XJC plugin according to http://stackoverflow.com/q/9377923/466738)
  • SearchRequest being generated as Searchrequest
  • Multiple classes not present in the XSD, eg. Ace, Acl, All, Authenticated... etc. - 30+ of them. Can someone explain where they came from and if the XSD could be updated to incorporate these types?
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <version>0.13.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <schemas>
                                <schema>
                                    <fileset>
                                        <directory>${basedir}</directory>
                                        <includes>
                                            <include>webdav.xsd</include>
                                        </includes>
                                    </fileset>
                                </schema>
                            </schemas>
                            <generatePackage>com.github.sardine.model</generatePackage>
                            <strict>false</strict>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

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

No branches or pull requests

4 participants