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

xsd-dependency-tree hangs with xsd's that import each other #28

Open
mywill opened this issue Mar 17, 2018 · 1 comment
Open

xsd-dependency-tree hangs with xsd's that import each other #28

mywill opened this issue Mar 17, 2018 · 1 comment

Comments

@mywill
Copy link

mywill commented Mar 17, 2018

I have been having a issue with importing some XSDs into my project, that i'm converting from maven, where the xsd to java task just hangs. I was able to recreate the issue with the following sample project. It may be related to #20 .

Using a mac running 10.13.1, gradle 4.6, version 2.4.1 of the plugin, and java 1.8.0_131, the following gradle file and xsd's the xsd-dependency-tree never seems to end and uses 100% of 1 cpu.

plugins {
    id "org.openrepose.gradle.plugins.jaxb" version "2.4.1"
}

repositories {
    mavenCentral()
}

jaxb {
    xsdDir = "${project.projectDir}/src/main/xsd"
    xjc {
        destinationDir = "${project.buildDir}/generated-sources/"
        generateEpisodeFiles = false
    }
}
dependencies {
    jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.11'
    jaxb 'com.sun.xml.bind:jaxb-impl:2.2.11'
    jaxb 'javax.xml.bind:jaxb-api:2.2.11'
}
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="xsd-cross-import-1-namespace">
    <xsd:import namespace="xsd-cross-import-2-namespace"
                schemaLocation= "xsd-cross-import-2.xsd"/>
    <xsd:element name="messageRequest">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="thing" type="xsd:string"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="messageResponse" type="xsd:boolean"/>
    <xsd:element name="messageFault" type="xsd:string"/>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="xsd-cross-import-2-namespace">
     <xsd:import namespace="xsd-cross-import-1-namespace"
                 schemaLocation= "xsd-cross-import-1.xsd"/>
     <xsd:element name="messageRequest">
         <xsd:complexType>
             <xsd:sequence>
                 <xsd:element name="thing2" type="xsd:string"/>
             </xsd:sequence>
         </xsd:complexType>
     </xsd:element>
 </xsd:schema>

The process produces the following logs on INFO


Initialized native services in: /Users/user/.gradle/native
Removing 0 daemon stop events from registry
Starting a Gradle Daemon (subsequent builds will be faster)
Starting process 'Gradle build daemon'. Working directory: /Users/user/.gradle/daemon/4.6 Command: /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /Users/user/.gradle/wrapper/dists/gradle-4.6-bin/4jp4stjndanmxuerzfseyb6wo/gradle-4.6/lib/gradle-launcher-4.6.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 4.6
Successfully started process 'Gradle build daemon'
An attempt to start the daemon took 1.014 secs.
The client will now receive all logging from the daemon (pid: 3389). The daemon log file: /Users/user/.gradle/daemon/4.6/daemon-3389.out.log
Starting build in new daemon [memory: 954.7 MB]
Using 8 worker leases.
Starting Build
Compiling settings file '/Users/user/Code/test-xsd-parse/settings.gradle' using SubsetScriptTransformer.
Compiling settings file '/Users/user/Code/test-xsd-parse/settings.gradle' using BuildScriptTransformer.
Settings evaluated using settings file '/Users/user/Code/test-xsd-parse/settings.gradle'.
Projects loaded. Root project using build file '/Users/uesr/Code/test-xsd-parse/build.gradle'.
Included projects: [root project 'test-xsd-parse']

> Configure project : 
Evaluating root project 'test-xsd-parse' using build file '/Users/user/Code/test-xsd-parse/build.gradle'.
Compiling build file '/Users/user/Code/test-xsd-parse/build.gradle' using SubsetScriptTransformer.
Compiling build file '/Users/user/Code/test-xsd-parse/build.gradle' using BuildScriptTransformer.

All projects evaluated.
Selected primary task 'xjc' from project :
Tasks to be executed: [task ':xsd-dependency-tree', task ':xjc']
:xsd-dependency-tree (Thread[Task worker for ':' Thread 4,5,main]) started.

> Task :xsd-dependency-tree 
Task ':xsd-dependency-tree' is not up-to-date because:
  Task has not declared any outputs.
jaxb: starting Namespace Task
resolving(grouping) '2' documents by their unique namespaces
resolving external dependencies for namespaces '[xsd-cross-import-1-namespace, xsd-cross-import-2-namespace]'
jaxb: generating xsd namespace dependency tree
creating baseNamespaces '0' as tree nodes
<-------------> 0% EXECUTING [5m 45s]
> :xsd-dependency-tree

Attached are the debug log and the sample project i used to recreate this issue
debuglog.txt
test-xsd-parse.zip

@wdschei
Copy link
Contributor

wdschei commented Mar 19, 2018

Thanks for the info on this @mywill. Based on this analysis, I too believe this is probably the same root cause as #20. We are actually getting ready to start some more updates to this plugin and specifically dealing with the xsd-dependency-tree task. I will take a closer look at this then and keep you posted.

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

2 participants