I'm attempting to generate pojos from an XML schema. Haven't gotten very
far.
Maven configuration:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.7.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
Running 'mvn clean install' on my project with this configuration yields the
following errors:
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error parsing the command line [[Ljava.lang.String;@7a0daa]
Embedded error: grammar is not specified
[INFO]
------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error parsing the
command line [[Ljava.lang.String;@7a0daa]
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
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:585)
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)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error parsing the
command line [[Ljava.lang.String;@7a0daa]
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.setupOptions(RawXJC2Mojo.java:481)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:249)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:134)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
... 16 more
Caused by: com.sun.tools.xjc.BadCommandLineException: grammar is not
specified
at com.sun.tools.xjc.Options.parseArguments(Options.java:795)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.setupOptions(RawXJC2Mojo.java:477)
... 20 more
In hopes that building my own plugin locally might yield better results I
downloaded the source code for the plugin and attempted to build (I had to
do this to get a schemagen plugin).
mvn clean install on the plugin project also gives errors:
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) com.sun:tools:jar:1.5.0
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.sun -DartifactId=tools
-Dversion=1.5.0 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file
there:
mvn deploy:deploy-file -DgroupId=com.sun -DartifactId=tools
-Dversion=1.5.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url]
-DrepositoryId=[id]
Path to dependency:
1) org.apache.maven.plugins:maven-plugin-plugin:maven-plugin:2.2
2) org.jfrog.maven.annomojo:maven-plugin-tools-anno:jar:1.3.1
3) com.sun:tools:jar:1.5.0
----------
1 required artifact is missing.
for artifact:
org.apache.maven.plugins:maven-plugin-plugin:maven-plugin:2.2
from the specified remote repositories:
central (
http://repo1.maven.org/maven2),
apache.incubating.plugins (
http://people.apache.org/repo/m2-incubating-repository),
apache.snapshots (
http://people.apache.org/repo/m2-snapshot-repository),
apache.incubating (
http://people.apache.org/repo/m2-incubating-repository
),
maven2-repository.dev.java.net (
http://download.java.net/maven/2),
maven-repository.dev.java.net (
http://download.java.net/maven/1)
Perhaps this is due to the fact that I'm running Mac OS X + JDK 1.5 that
does not have a tools.jar? Has anyone had success running the JAXB maven
plugins? Thus far it's been very difficult to get thesse plugins to work.
Any help would be much appreciated.
Thanks,
Ben Vanberg