Giter VIP home page Giter VIP logo

gradle-jaxb-plugin's People

Contributors

bitdeli-chef avatar mraccola avatar stephanheinze avatar stianh avatar stigkj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gradle-jaxb-plugin's Issues

Failure due to external resource restriction in recent Java 7/8

Hi,

I recently upgraded my OpenJDK (7.u40_2.4.0 -> 7.u40_2.4.1) and I think I've been bitten by the same problem as described in [1]:

:generateSchemaSource FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generateSchemaSource'.
> java.lang.AssertionError: org.xml.sax.SAXParseException; systemId: jar:file:/home/estan/.gradle/caches/artifacts-23/filestore/com.sun.xml.bind/jaxb-xjc/2.2.7/jar/f351eed8b1ee9a1dd242bf81bf7a391c40a16d18/jaxb-xjc-2.2.7.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; schema_reference: Failed to read schema document 'xjc.xsd', because 'file' access is not allowed due to restriction set by the accessExternalSchema property.

I'm not sure if the Gradle plugin is able to solve this, since I can't find a way in the Ant task to control the JAXP features used (to turn off the now default restricted access to external resources), but I'll file it as a bug here since at the moment I've had to downgrade my JDK to work around the problem.

Thanks a lot for an otherwise nice plugin!

[1] https://java.net/jira/browse/MAVEN_JAXB2_PLUGIN-80

jaxb source sets

Would it be possible to flesh out this section a little more and to give some examples, at first glance I have no idea what this section refers to or what I am supposed to do. Do I include this in my build.gradle and also what are the most common default settings (at a very minimum, what do I need?)

the jaxb source directory sets

sourceSets {
    main {
        jaxb {
            <setup srcDir, includes, excludes, output, etc>
        }
    }

    test {
        jaxb {
            <setup srcDir, includes, excludes, output, etc>
        }
    }
}

Make it possible to configure schemaDir

Currently the schemaDir is hard coded to "src/${sourceSet.name}/jaxb". Request to allow the default to be changed via a plugin convention object.

I took a look at the source code and it seems the plugin does define a convention object but the name of the object, JaxbSourceDirectory, does not lend itself to extension. I would be happy to create a patch if you felt like it was OK to rename the convention object perhaps to JaxbPluginConvention?

Also, please consider changing the default from "src/${sourceSet.name}/jaxb" to "src/${sourceSet.name}/xsd". This might be more appropriate because there could be other uses for these schemas other than just JAXB code generation.

Project dead confirmation

I did get some feedback from one of the contributors to the project that this project is dead, has not been updated to work with later JDK's and no future plan to refresh the project.

Ideally when something does not work and no intention to update, would hope this project would be deleted from github and all references to it everywhere; It sucked a lot of time away from my day thinking I was doing something wrong, but in the end it was simply dead, not working code.

Dead project

It looks like this plugin project is dead; if anyone has a working example of how to use JAXB with gradle (using JDK 1.6 or higher), please let me know.

It looks like someone somewhere will have to jump in and rewrite this from scratch; I would but have little time, will put it on the stack of other things out there that were started and then abandoned.

Do not force jaxb-xjc to be in compile configuration

The plugin currently requires the jaxb-xjc library to be added to the jaxb Configuration. The compile Configuration inherits from the jaxb Configuration which ultimately means that the jaxb-xjc library MUST be a part of the compile Configuration.

This is unwanted. The jaxb-xjc library is only needed during the build process to generate the Java classes it is not needed to actually compile the code.

One example of an unwanted side effect of this is that if you have a WAR file that depends on the project that has the jaxb plugin applied, the WAR file will end up with a jaxb-xjc.jar file in the WEB-INF/lib, unnecessarily bloating the WAR file. This of course can be worked around by excluding the jaxb-xjc from the War project's compile dependency but this should not be necessary.

Also, in regards to compiling the generated Java files I realize we still need to add the jaxb-api/jaxb-impl JARs to the compile Configuration. Please consider whether it is the job of the jaxb plugin to actual assist in seting up these JARs in the compile Configuration at all? Perhaps it is just expected that the jaxb-api/jaxb-impl will be added to the normal compile Confguration directly like this:

compile ("com.sun.xml.bind:jaxb-impl:2.1.3")

instead of

jaxb ("com.sun.xml.bind:jaxb-impl:2.1.3")

Not saying I have a strong opinion...just a question.

Question (2) about the usage section

I am confused about this snippet of code in the usage section:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'no.entitas.gradle.jaxb:gradle-jaxb-plugin:2.0'
}
}


In my build script I have a separate dependencies{} section and a repositories {} section that does not live inside a buildscript{} section.

What is the code above doing that in the Usage: section there are two dependencies{} section and the 'repositories{} lives inside a buildscript{} section?

Set defaults for sonatypeUsername and sonatypePassword

Set a default value of "" for the two project properties mentioned above so that the build can be executed without setting these properties. This would be useful for developers working on patches who do not have or need access to the username and password.

Questions about the "Usage" section

I am looking at the Usage section and there is this snipped of code:

dependencies {
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.4-1'
}

I typically see gradle build files that have lines that begin with 'compile group' or 'testCompile group:'

What does beginning the line with 'jaxb' do, should this not simply be 'compile'?

If you look at this URL section 8.3, and 8.4. I am trying to understand the Usage section in detail.

Publish a new release?

It looks like the code on the master != release 2.0 in maven-central/jcenter.

When applying release 2.0 to my project with Gradle 1.11 I get the warnings:

The ConfigurationContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.

As the warnings suggest, with Gradle 2.0-rc-1 the plugin is unusable as it results in an error:

* What went wrong:
A problem occurred evaluating script.
> Could not find method add() for arguments [jaxb, no.entitas.gradle.jaxb.plugin.JaxbPlugin$_apply_closure1@79726c51] on configuration container.

This, while on the master this issue was already fixed a year ago (23-5-2013).

Can you please publish a new release to make the plugin compatible with Gradle 2+?

gradle-jaxb-plugin pulls down jaxb, I want to use JDK native jaxb integration

When I followed the Usage example and ran a $gradle build, I got the following:

Download http://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-xjc/2.2.4-1/jaxb-xjc-2.2.4-1.pom
Download http://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.2.4-1/jaxb-impl-2.2.4-1.pom
Download http://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.2.3/jaxb-api-2.2.3.pom
Download http://repo1.maven.org/maven2/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.pom
Download http://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-xjc/2.2.4-1/jaxb-xjc-2.2.4-1.jar
Download http://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.2.4-1/jaxb-impl-2.2.4-1.jar
Download http://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.2.3/jaxb-api-2.2.3.jar
Download http://repo1.maven.org/maven2/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar

Notice this is pulling down jars from com.sun.xml.bind.jaxb-api/2.2.3/jaxb-api-2.2.3.jar and jaxb-xjc and jaxb-impl and stax-api and much more.

I don't want to use any of those; I am using JDK 1.6 which does not need these jars as dependencies; I want to use the JAXB capabilities built into the JDK.

How to make this plugin work so that it only pulls what is needed when using JDK 1.6 or higher? Can the Usage section be updated (as most of the free world is on JDK 1.6 or higher?)

Very confused by using this plugin.

Change the default source directory to .../xsd

As @mraccola mentioned in #5, it would make more sense that the default source directory is .../xsd instead of .../jaxb. This signals that the schemas can be used for other things besides generating source code from.

Spelled out, this means changing the plugin to use "src/${sourceSet.name}/xsd as the default.

Cause: taskdef class com.sun.tools.xjc.XJCTask cannot be found

Version 1.1-SNAPSHOT Gradle 1.0 Milestone 3

I have added jaxb-xjc as a dependecy:

dependencies {
classpath module(group: 'no.entitas', name: 'gradle-jaxb-plugin', version: '1.1-SNAPSHOT'){
dependency "com.sun.xml.bind:jaxb-xjc:2.2.4-1"
}

  • What went wrong:
    A problem occurred evaluating root project 'fiqu-ws'.
    Cause: taskdef class com.sun.tools.xjc.XJCTask cannot be found
    using the classloader AntClassLoader[]
    Cause: com.sun.tools.xjc.XJCTask
  • Try:
    Run with --info or --debug option to get more log output.
  • Exception is:
    org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'fiqu-ws'.
    at org.gradle.groovy.scripts.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:51)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:127)
    at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:38)
    at org.gradle.configuration.DefaultProjectEvaluator.evaluate(DefaultProjectEvaluator.java:38)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:487)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:71)
    at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)
    at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)
    at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:38)
    at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:35)
    at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:463)
    at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:458)
    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:141)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)
    at org.gradle.launcher.RunBuildAction.execute(RunBuildAction.java:41)
    at org.gradle.launcher.RunBuildAction.execute(RunBuildAction.java:27)
    at org.gradle.launcher.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
    at org.gradle.launcher.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
    at org.gradle.launcher.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:219)
    at org.gradle.launcher.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:203)
    at org.gradle.launcher.Main.execute(Main.java:55)
    at org.gradle.launcher.Main.main(Main.java:40)
    at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:46)
    at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:28)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
    Caused by: : taskdef class com.sun.tools.xjc.XJCTask cannot be found
    using the classloader AntClassLoader[]
    at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:622)
    at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:239)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:71)
    at org.gradle.api.internal.project.ant.BasicAntBuilder.doInvokeMethod(BasicAntBuilder.java:86)
    at org.gradle.api.internal.project.DefaultAntBuilder.super$3$invokeMethod(DefaultAntBuilder.groovy)
    at org.gradle.api.internal.project.DefaultAntBuilder.invokeMethod(DefaultAntBuilder.groovy:37)
    at no.entitas.gradle.JaxbPlugin$_createJaxbTask_closure6.doCall(JaxbPlugin.groovy:67)
    at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:61)
    at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:31)
    at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:398)
    at org.gradle.api.internal.project.AbstractProject.task(AbstractProject.java:929)
    at org.gradle.api.Project$task$0.call(Unknown Source)
    at no.entitas.gradle.JaxbPlugin.createJaxbTask(JaxbPlugin.groovy:63)
    at no.entitas.gradle.JaxbPlugin.this$2$createJaxbTask(JaxbPlugin.groovy)
    at no.entitas.gradle.JaxbPlugin$this$2$createJaxbTask.callCurrent(Unknown Source)
    at no.entitas.gradle.JaxbPlugin.injectJaxbTask(JaxbPlugin.groovy:48)
    at no.entitas.gradle.JaxbPlugin.this$2$injectJaxbTask(JaxbPlugin.groovy)
    at no.entitas.gradle.JaxbPlugin$this$2$injectJaxbTask.callCurrent(Unknown Source)
    at no.entitas.gradle.JaxbPlugin.apply(JaxbPlugin.groovy:19)
    at no.entitas.gradle.JaxbPlugin.apply(JaxbPlugin.groovy)
    at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.providePlugin(DefaultProjectsPluginContainer.java:103)
    at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.addPluginInternal(DefaultProjectsPluginContainer.java:67)
    at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.apply(DefaultProjectsPluginContainer.java:37)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
    at org.gradle.api.internal.project.AbstractProject.apply(AbstractProject.java:854)
    at org.gradle.api.Project$apply.call(Unknown Source)
    at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:35)
    at org.gradle.api.Script$apply.callCurrent(Unknown Source)
    at build_793i7ponmfq6pjb8167hanitg1.run(D:\Projekte\fiqu-ws\build.gradle:3)
    at org.gradle.groovy.scripts.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:49)
    ... 26 more
    Caused by: java.lang.ClassNotFoundException: com.sun.tools.xjc.XJCTask
    at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1361)
    at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1311)
    at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1064)
    at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:594)
    ... 60 more

Usage

When I added just this:

apply plugin: 'jaxb'

buildscript {
repositories {
mavenLocal()
mavenCentral()

    maven {
        credentials {
            username ""
            password ""
        }
        url "https://myrepo.mycomp.com"
    }
}
dependencies {
    classpath 'no.entitas.gradle.jaxb:gradle-jaxb-plugin:2.0'
}

}

dependencies {
compile 'org.springframework:spring-core:4.0.6.RELEASE'
compile 'org.springframework:spring-context:4.0.6.RELEASE'
compile 'org.apache.commons:commons-email:1.3.3'
// why does not begin with 'compile'?
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.4-1'

// QA
testCompile 'org.springframework:spring-test:4.0.6.RELEASE'
testCompile group: 'junit', name: 'junit', version: '4.+'

}

I get an error:

$ gradle build
Download http://repo1.maven.org/maven2/no/entitas/gradle/jaxb/gradle-jaxb-plugin/2.0/gradle-jaxb-plugin-2.0.pom
Download http://repo1.maven.org/maven2/no/entitas/gradle/jaxb/gradle-jaxb-plugin/2.0/gradle-jaxb-plugin-2.0.jar
The ConfigurationContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
:generateSchemaSource UP-TO-DATE
:compileJava

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all dependencies for configuration ':compile'.

    Could not find org.springframework:spring-core:4.0.6.RELEASE.
    Required by:
    :mymodule:unspecified
    Could not find org.springframework:spring-context:4.0.6.RELEASE.
    Required by:
    :mymodule:unspecified
    Could not find cglib:cglib:2.2.2.
    Required by:
    :mymodule:unspecified
    Could not find com.force.api:force-wsc:22.0.0.
    Required by:
    :ForceOnbaseImportNB:unspecified
    Could not find org.apache.commons:commons-email:1.3.3.
    Required by:
    :mymodule:unspecified
    Could not find com.sun.xml.bind:jaxb-xjc:2.2.4-1.
    Required by:
    :mymodule:unspecified

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.852 secs

This plugin is broken & hangs with JDK 1.6

When I run this plugin with JDK 1.6.0_45, it hangs and never returns to the command prompt.

$ gradle build
The ConfigurationContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
:generateSchemaSource UP-TO-DATE
:compileJava
:processResources UP-TO-DATE
:classes
:jar UP-TO-DATE
:assemble UP-TO-DATE
:generateTestSchemaSource UP-TO-DATE
:compileTestJava
(it hangs here forever and does not return until I hit Cntrl-C)

Allow Maven install without signing

Would be nice to be able to install the artifact into a local Maven repository without needing to digitally sign the artifact.

Currently, running the following command:

gradle install

results in the following error:

Execution failed for task ':signArchives'.
Cause: Cannot perform signing task ':signArchives' because it has no configured signatory

This is a problem for developers who do not have access to the signing key.

Release notes

Want to upgrade but I couldn't find any release notes. Can you please provide release notes for the past 3 releases?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.