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

'sbt compile' doesn't build anything #8

Open
dtbullock opened this issue Jun 15, 2015 · 13 comments
Open

'sbt compile' doesn't build anything #8

dtbullock opened this issue Jun 15, 2015 · 13 comments

Comments

@dtbullock
Copy link

Do it from the root directory of the checked-out sources, and it does nothing.

Do it from each sub-project with their own build.sbt files and:
a) 'xjc-plugin' builds ok
b) 'client' fails with:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from C:\Users\David\Documents\Hacking\xero-java-client-2\client\project
[info] Updating {file:/C:/Users/David/Documents/Hacking/xero-java-client-2/client/project/}client-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to client (in build file:/C:/Users/David/Documents/Hacking/xero-java-client-2/client/)
[info] Updating {file:/C:/Users/David/Documents/Hacking/xero-java-client-2/client/}client...
[info] Resolving com.connectifier.xero#xjc-plugin;0.1-SNAPSHOT ...
[warn]  module not found: com.connectifier.xero#xjc-plugin;0.1-SNAPSHOT
[warn] ==== local: tried
[warn]   C:\Users\David\.ivy2\local\com.connectifier.xero\xjc-plugin\0.1-SNAPSHOT\ivys\ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/connectifier/xero/xjc-plugin/0.1-SNAPSHOT/xjc-plugin-0.1-SNAPSHOT.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.connectifier.xero#xjc-plugin;0.1-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Unresolved dependencies path:
[warn]          com.connectifier.xero:xjc-plugin:0.1-SNAPSHOT ((com.github.retronym.sbtxjc.SbtXjcPlugin) SbtXjcPlugin.scala#L43)
[warn]            +- com.connectifier.xero:client:0.13 
@benmccann
Copy link
Owner

If you do cd xjc-plugin and sbt publish-local and then recompile the client does that fix the problem for you?

@dtbullock
Copy link
Author

Hi Ben, sorry for the delay in replying.

publish-local does get me further, thanks (SBT is a new to me, and I hadn't found that task yet, although I suppose if I knew Ivy I could have deduced it).

I do still get a failure trying to compile:

[info] Compiling 127 Java sources to C:\Users\David\Documents\Hacking\xero-java-client-3\client\target\classes...
[error] (compile:compileIncremental) javac returned nonzero exit code
[error] Total time: 7 s, completed 16/06/2015 3:42:47 PM

SBT doesn't call out the exact problem, but it seems to be line 314 of c.c.xc.XeroClient which tries to call the generated ObjectFactory#createReceipt() method, with the false expectation that it accepts a Receipt as an argument and returns a JAXBElement:

  public List<Receipt> createReceipt(Receipt receipt) {
    return put("Receipts", objFactory.createReceipt(receipt)).getReceipts(); // line 314
  }

The happy news is, when I remove that method from XeroClient, I can now build the app, create an instance of XeroClient, and list some invoices from the demo app!

In general, I like the minimalist technology decisions in c.c.xc. Thanks for sharing it.

@tonyjayfunk
Copy link

Hello,

I'm hitting the same problem. sbt compile won't go through.

MacBook-Soufian:client soufian$ sbt compile
[info] Loading project definition from /Users/soufian/git/xero-java-client/client/project
[info] Set current project to client (in build file:/Users/soufian/git/xero-java-client/client/)
[info] Compiling 1 XSD file(s) to /Users/soufian/git/xero-java-client/client/target/src_managed/main
analyse dun schéma...
[ERROR] 'Invoice' is already defined
ligne 68 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Invoice.xsd

[ERROR](related to above error) the first definition appears here
ligne 77 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/CreditNote.xsd

[ERROR] 'CreditNote' is already defined
ligne 110 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Invoice.xsd

[ERROR](related to above error) the first definition appears here
ligne 20 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/CreditNote.xsd

[ERROR] 'ArrayOfCreditNote' is already defined
ligne 116 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Invoice.xsd

[ERROR](related to above error) the first definition appears here
ligne 14 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/CreditNote.xsd

[ERROR] 'Allocation' is already defined
ligne 28 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Allocation.xsd

[ERROR](related to above error) the first definition appears here
ligne 54 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/CreditNote.xsd

[ERROR] 'ArrayOfAllocation' is already defined
ligne 34 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Allocation.xsd

[ERROR](related to above error) the first definition appears here
ligne 71 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/CreditNote.xsd

[ERROR] 'TrackingCategories' is already defined
ligne 8 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Tracking.xsd

[ERROR](related to above error) the first definition appears here
ligne 37 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/LineItem.xsd

[ERROR] 'TrackingCategory' is already defined
ligne 26 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Tracking.xsd

[ERROR](related to above error) the first definition appears here
ligne 39 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/LineItem.xsd

[ERROR] 'ArrayOfTrackingCategory' is already defined
ligne 45 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Tracking.xsd

[ERROR](related to above error) the first definition appears here
ligne 53 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/LineItem.xsd

[ERROR] 'Payments' is already defined
ligne 10 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Payment.xsd

[ERROR](related to above error) the first definition appears here
ligne 68 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Invoice.xsd

[ERROR] 'Payment' is already defined
ligne 11 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Payment.xsd

[ERROR](related to above error) the first definition appears here
ligne 69 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Invoice.xsd

[ERROR] 'Payment' is already defined
ligne 34 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Payment.xsd

[ERROR](related to above error) the first definition appears here
ligne 72 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Invoice.xsd

[ERROR] 'ArrayOfPayment' is already defined
ligne 40 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Payment.xsd

[ERROR](related to above error) the first definition appears here
ligne 92 sur file:/Users/soufian/git/XeroAPI-Schemas/v2.00/Invoice.xsd

Echec de lanalyse dun schéma.
java.lang.RuntimeException: Non zero return code from xjc [255]
at scala.sys.package$.error(package.scala:27)
at com.github.retronym.sbtxjc.SbtXjcPlugin$.com$github$retronym$sbtxjc$SbtXjcPlugin$$xjcCompile(SbtXjcPlugin.scala:110)
at com.github.retronym.sbtxjc.SbtXjcPlugin$$anonfun$xjcSettings0$3.apply(SbtXjcPlugin.scala:64)
at com.github.retronym.sbtxjc.SbtXjcPlugin$$anonfun$xjcSettings0$3.apply(SbtXjcPlugin.scala:64)
at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:35)
at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:34)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:235)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
error Non zero return code from xjc [255]
[error] Total time: 2 s, completed 21 nov. 2015 17:18:03
MacBook-Soufian:client soufian$ ⁄’’’’’

@dtbullock
Copy link
Author

@tonyjayfunk that's because XeroAPI-Schemas introduced a dumb change where they removed perfectly good <xs:include schemaLocation="otherfile.xsd" /> directives and instead pasted the referenced material directly into the file. WHY they did this, I'm not sure, but I could sure hit someone over there. I think on the .NET side some tool doesn't cope with A.xsd including B.xsd which in turns includes A.xsd (which xjc seems to cope with just fine, thanks).

@benmccann
Copy link
Owner

@dtbullock can you link to the commit on their side that broke things?

@dtbullock
Copy link
Author

@benmccann I couldn't identify a single commit which did all the damage - it's more of a mindset thing which has crept in through a series of commits. If you fetch (but not checkout) their latest stuff and run the history GUI over it, you'll see a messy tangle in recent times which makes it difficult to isolate. The disease seems to have started around '4cf8b534c88e0af01f94380dcdc0a46a53433961 (Removed credit note circular deps)' and 'c43766c497c2d42560a147fde485c500d5fcefa3 (Moved payments into the file)'. In my dev environment I've just been fixing up the damage as reported by xjc and putting the xs:include/ 's back. I've had to touch Contact.xsd, CreditNote.xsd, Invoice.xsd, and LineItem.xsd.

@dtbullock
Copy link
Author

I pushed my manual fixes to https://github.com/dtbullock/XeroAPI-Schemas/tree/circularfix in case anybody wants them. They are one step ahead of XeroAPI/XeroAPI-Schema/master. No warranties, except that xjc doesn't barf on duplicate declarations.

Note that I still have to comment out what are now lines 323-235 of XeroClient.java:

public List<Receipt> createReceipt(Receipt receipt) {
  return put("Receipts", objFactory.createReceipt(receipt)).getReceipts();
}

... because ObjectFactory#createReceipt(Receipt) isn't present. xjc seems to omit generating a method of that signature. I'm not sure what's so different about my dev env that nobody else seems to have this problem.

It's especially annoying since sbt is unhelpfully brief and says merely 'javac returned nonzero exit code' (and I can't work out how to coax it to be more specific ... would be happy to hear of solutions). I have a of contributions to make (including support for attachments), but don't feel comfortable doing it when I can't actually compile the same XeroClient.java which everyone else seems to have no trouble with.

I suspect it may well come down to 'xero-java-client is only known to work with XeroAPI-Schema version X'.

@benmccann
Copy link
Owner

Yeah, if you look at last date xero-java-client was published in Maven you can sync to XeroAPI-Schema of same date and build

@dtbullock
Copy link
Author

OK, I have the world making sense. Using XeroAPI-Schema commit caa5a6a081f895f90290798767008b85c39bd247 (the last commit pulled from Ben McCann, even though it appears to have been pulled in December 2015, instead of April 2015), I can successfully build xero-java-client as of commit 3771ddc (tagged 'rel0.13') without any errors.

The problem with receipts was added immediately after xero-java-client rel0.13, in commit 3771ddc where Richard Hensman added the method which I can't get to compile. That would be because XeroAPI-Schema still hasn't merged his pull request.

OK, I can work with this.

@benmccann benmccann reopened this Jan 6, 2016
@benmccann
Copy link
Owner

Thanks. I'm going to leave this open for others that have the problem.

Do you think there's a way XeroAPI-Schema can be restructured such that it doesn't have duplicate declarations or circular references? That would make everyone happy

@dtbullock
Copy link
Author

Well, first I'm going to have to see what the Microsoft tooling does with the circular references, what problems duplicate declarations is actually attempting to solve, and if they can be solved another way.

If Microsoft defeat me, I would lean towards an XSLT script which transformed the good circular-references versions into one big file, for consumption by the lacklustre tooling. It adds a step, but retains maintainability.

As a desperate hack, I would probably lump all the things which mutually depend on each other into the same sorry .xsd file, but it might end up being pretty big - there seems to be a tangle of 3 and a tangle of 2. But that seems pretty desperate.

@dtbullock
Copy link
Author

I address the circular reference question here: XeroAPI/XeroAPI-Schemas#32

@benmccann
Copy link
Owner

@dtbullock would you be able to try try xmllint (the tool Xero was using) on your schemas? I'd like to see if we can get a working version upstream again

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

3 participants