lookfirst / sardine

an easy to use webdav client for java
Other
583 stars 186 forks source link

Make code generation part of Maven lifecycle #257

Open xasx opened 8 years ago

xasx commented 8 years ago

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 commented 8 years ago

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

dankarp commented 8 years ago

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

adammichalik commented 8 years ago

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:

            <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>