users@jaxb.java.net

Re: Maven 2 Jaxb2 plugin available.

From: Malachi de Ælfweald <malachid_at_gmail.com>
Date: Thu, 18 May 2006 07:00:09 -0700

Comments inline

On 5/17/06, Jonathan Johnson <jonjohnson_at_mail.com> wrote:
>
> Malachi,
>
> Ah, there you are. Thanks for helping!
>
> >> 1. it says that "includeSchemas" was not set, but I set it as per
> >> instructions (but told it to recurse subdirectories)
>
> You indeed found a problem (it was missing an important @parameter tag).
> The plugin has been fixed and reposted.
> Instructions are here: http://jaxb.dev.java.net/jaxb-maven2-plugin/


Kewl. I'll grab the new one.

>> 2. instead of running under reactor, it tried to run on the outside
> >> pom which has no source code -- and thus hard crashed the build
>
> I'm not clear on what you are describing here. I'm not sure of the steps
> to
> follow to reproduce this. Can you provide more details?


Instructions are here:
http://maven.apache.org/guides/getting-started/index.html#How%20do%20I%20build%20more%20than%20one%20project%20at%20once
?

Generally, it follows like this.... the root project directory contains a
pom.xml that contains a "<modules>" section. Each module specified a
subproject directory, which contains it's own pom.xml

In my case specifically, all my build setup is on the outside pom.xml, which
has no source code itself. Then each child pom.xml has the very minimal
settings (usually, which other subproject it depends on -- in order to allow
maven to determine the correct order to build them).


>> how do I enable an external jaxb plugin
>
> This was a feature for the next version. I would image a section in the
> configuration section like this...
>
> <classpaths>
> <classpath>/path/to/jaxb-xjc.jar</classpath>
> <classpath>/path/to/plugin.jar</classpath>
> </classpaths >
>
> Which in turn would call XJC2Task.setClasspath(...)
>
> But I'm not sure how to invoke the plugin methods as you can do in an Ant
> command
>
> <xjc ...>
> <arg value="-Xinject-code" />
> ... other nested elements ...
> </xjc>
>
> Perhaps you or Kohsuke can advise me.
>
>
> - Jonathan


As I see it, there are two primary things we have to do. One, make sure that
it is on the classpath (which is counter-intuitive for maven, since we got
away from specifying classpaths); Two, to specify the -Xoption to actually
get it called...

Does the -Xoption require that vendor extensions are turned on?
If so, then perhaps we change <extension>true</extension>
to
<extensions enabled="true">
  <extension>Xlocator</extension>
</extensions>

then, we just have to deal with it being on the classpath...

-----Original Message-----
> From: Malachi de Ælfweald [mailto:malachid_at_gmail.com]
> Sent: Wednesday, May 17, 2006 11:05 PM
> To: users_at_jaxb.dev.java.net
> Subject: Re: Maven 2 Jaxb2 plugin available.
>
> Sorry it took me so long to test it... I noticed a couple problems....
>
> 1. it says that "includeSchemas" was not set, but I set it as per
> instructions (but told it to recurse subdirectories)
> 2. instead of running under reactor, it tried to run on the outside
> pom which has no source code -- and thus hard crashed the build
> 3. how do I enable an external jaxb plugin
>
> My configuration (on outside reactor pom.xml, not individual project):
>
> <plugin>
> <groupId>com.sun.tools.xjc.maven2
> </groupId>
> <artifactId>maven-jaxb-plugin</artifactId>
> <executions>
> <execution>
> <goals>
>
> <goal>generate</goal
> >
> </goals>
> </execution>
> </executions>
> <configuration>
>
> <schemaDirectory>src/main</schemaDir
> ectory>
> <extension>true</extension>
> <verbose>true</verbose>
> <includeSchemas>
>
> <includeSchema>**/*.xsd</inc
> ludeSchema>
> </includeSchemas>
> </configuration>
> </plugin>
>
>
> Result:
>
> [INFO] [jaxb:generate {execution: default}]
> [INFO] The <includeSchemas> setting was not defined, assuming *.xsd.
> [INFO] The <includeBindings> setting was not defined, assuming *.xjb.
> [INFO] schemaDirectory: C:\development\devel.eoti.org\src\main
> [INFO] includeSchemas: [*.xsd]
> [INFO] excludeSchemas: null
> [INFO] includeBindings: [*.xjb]
> [INFO] excludeBindings: null
> [INFO] generatePackage: null
> [INFO] generateDirectory:
> C:\development\devel.eoti.org\target\generated-sources\xjc
> [INFO] readOnly: false
> [INFO] extension: true
> [INFO] catalog: null
> [INFO] removeOldOutput: false
> [INFO] strict: true
> [INFO] verbose: true
> [INFO]
> ---------------------------------------------------------------------
> -------
> [ERROR] FATAL ERROR
> [INFO]
> ---------------------------------------------------------------------
> -------
> [INFO] basedir C:\development\devel.eoti.org\src\main does not exist
> [INFO]
> ---------------------------------------------------------------------
> -------
> [INFO] Trace
> java.lang.IllegalStateException: basedir
> C:\development\devel.eoti.org\src\main does not exist
> at
> org.apache.tools.ant.DirectoryScanner.scan(DirectoryScanner.java:645)
> at com.sun.tools.xjc.maven2.XJCMojo.getFiles(XJCMojo.java:413)
> at com.sun.tools.xjc.maven2.XJCMojo.execute(XJCMojo.java:194)
> at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo
> (DefaultPluginManage
> r.java:415)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
> (DefaultLife
> cycleExecutor.java:531)
> at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
> (DefaultLifecycleExecutor.java:472)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> (DefaultLifec
> ycleExecutor.java:451)
> at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFail
> ures(DefaultLifecycleExecutor.java:303)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
> (Defa
> ultLifecycleExecutor.java:270)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
> (DefaultLifecycle
> Executor.java:139)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
> :39
> )
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:589)
> at
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> at
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>