varlink / java

Java bindings and tools for Varlink

Home Page:https://varlink.org/java/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

varlink-idl build is broken

jonpetersathan opened this issue · comments

The current build is broken due to some errors while running maven goal tend-maven-plugin:2.12.0:compile for varlink-idl, which happens if you do a mvn clean install for the whole project.
I'm unsure why this problem appears, since i didn't find any code changes that would have caused it.
I'm also to unfamiliar with xtend and xtext to fix the problem by myself.

It looks like that the tend maven plugin is not able to find the java sources in the src-gen folder of java/varlink-idl/de.dentrassi.varlink.idl/:

[INFO] --- xtend-maven-plugin:2.12.0:compile (default) @ de.dentrassi.varlink.idl ---
[WARNING] Compilation of stubs had errors.
[ERROR] 
ERROR: 	VarlinkIdlValidator.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/validation/VarlinkIdlValidator.xtend
13: de.dentrassi.varlink.idl.varlinkIdl.Field cannot be resolved to a type.
[ERROR] 
ERROR: 	VarlinkIdlValidator.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/validation/VarlinkIdlValidator.xtend
15: de.dentrassi.varlink.idl.varlinkIdl.VarlinkIdlPackage cannot be resolved to a type.
[ERROR] 
ERROR: 	VarlinkIdlValidator.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/validation/VarlinkIdlValidator.xtend
17: AbstractVarlinkIdlValidator cannot be resolved to a type.
[ERROR] 
ERROR: 	VarlinkIdlValidator.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/validation/VarlinkIdlValidator.xtend
22: Field cannot be resolved to a type.
[ERROR] 
ERROR: 	VarlinkIdlValidator.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/validation/VarlinkIdlValidator.xtend
28: The method error(String, Field, Object) is undefined
[ERROR] 
ERROR: 	VarlinkIdlValidator.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/validation/VarlinkIdlValidator.xtend
28: The method or field VarlinkIdlPackage is undefined
[ERROR] 
ERROR: 	VarlinkIdlValidator.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/validation/VarlinkIdlValidator.xtend
32: The method error(String, Field, Object) is undefined
[ERROR] 
ERROR: 	VarlinkIdlValidator.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/validation/VarlinkIdlValidator.xtend
32: The method or field VarlinkIdlPackage is undefined
[ERROR] 
ERROR: 	VarlinkIdlValidator.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/validation/VarlinkIdlValidator.xtend
36: The method error(String, Field, Object, String) is undefined
[ERROR] 
ERROR: 	VarlinkIdlValidator.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/validation/VarlinkIdlValidator.xtend
36: The method or field VarlinkIdlPackage is undefined
[ERROR] 
ERROR: 	VarlinkIdlValidator.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/validation/VarlinkIdlValidator.xtend
17: Superclass must be a class
[ERROR] 
ERROR: 	VarlinkIdlRuntimeModule.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/VarlinkIdlRuntimeModule.xtend
17: AbstractVarlinkIdlRuntimeModule cannot be resolved to a type.
[ERROR] 
ERROR: 	VarlinkIdlRuntimeModule.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/VarlinkIdlRuntimeModule.xtend
17: Superclass must be a class
[ERROR] 
ERROR: 	VarlinkIdlScopeProvider.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/scoping/VarlinkIdlScopeProvider.xtend
13: AbstractVarlinkIdlScopeProvider cannot be resolved to a type.
[ERROR] 
ERROR: 	VarlinkIdlScopeProvider.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/scoping/VarlinkIdlScopeProvider.xtend
13: Superclass must be a class
[ERROR] 
ERROR: 	VarlinkIdlStandaloneSetup.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/VarlinkIdlStandaloneSetup.xtend
17: VarlinkIdlStandaloneSetupGenerated cannot be resolved to a type.
[ERROR] 
ERROR: 	VarlinkIdlStandaloneSetup.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/VarlinkIdlStandaloneSetup.xtend
20: The method createInjectorAndDoEMFRegistration() is undefined for the type VarlinkIdlStandaloneSetup
[ERROR] 
ERROR: 	VarlinkIdlStandaloneSetup.xtend - /home/travis/build/varlink/java/varlink-idl/de.dentrassi.varlink.idl/src/de/dentrassi/varlink/idl/VarlinkIdlStandaloneSetup.xtend
17: Superclass must be a class

I was trying to compile the whole project from source, because the current version of the published maven plugin (0.2.0) is broken, which i needed in order to create java bindings for the podman project.

I am trying to reproduce the issue, maybe you can help me by explaining what is broken with the maven plugin.

It also looks as if some tweaks are necessary when running maven with a Java 9+ JVM. Which version of Java are you using? And if it is not Java 8, then please try with a Java 8 VM so see if the problem still remains.

I pushed a few changes to the develop branch, which should make this play nice, even when you are using Java 9+.

Thanks for the fast response, I was using Java 11 but I thought I tried it with Java 8. I will try it again as soon as I'm home.

The problem with the maven plugin (0.2.0 - last published version) was, that the generated code had errors. After a short inspection I noticed that the errors came from the varlink-bindings which I declared as parent module inside my pom (as stated in the README). After comparing the code from the published version with the code in the develop branch it seemed like the code generated by the maven plugin was expecting the never version of the varlink-bindings.

If you want to reproduce this, I was using the following varlink file: https://raw.githubusercontent.com/containers/libpod/master/cmd/podman/varlink/io.podman.varlink

With these settings inside my pom:

<build>
    <plugins>
        <plugin>
            <groupId>de.dentrassi.varlink</groupId>
            <artifactId>varlink-maven-plugin</artifactId>
            <version>0.2.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

and

<parent>
    <groupId>de.dentrassi.varlink.bindings</groupId>
    <artifactId>varlink-bindings</artifactId>
    <version>0.2.0</version>
</parent>

Yes it's working now! I can compile the current branch with Java 8 and Java 11.
Thank you very much!

And I also fixed the code generated by the maven plugin: I added the following dependency instead of the parent module to my pom:

    <dependency>
      <groupId>de.dentrassi.varlink</groupId>
      <artifactId>varlink-core</artifactId>
      <version>0.2.1-SNAPSHOT</version>
    </dependency>

(This also works with 0.2.0)

Hm ok ... so I guess I will publish a new version of this.

Yeah, but I'm still not sure why the maven plugin is not working. If you declare the varlink-bindings as parent module the varlink-core version is outdated. But if you declare the varlink-core directly as dependency everything works just fine.

So maybe just update the README file of the maven plugin.

Can you create a reproducer repository for me?

Of course, here you go: https://github.com/BBJip/varlink-java-maven-plugin-test

In process of creating this repo, I figured out parts of the problem. It seems that if I add varlink-bindings as parent module, then maven tries to download the version of varlink-core matching my project version. Because I was using 0.0.1 as my project version, which is coincidentally also a varlink-core release, maven was downloading all dependencies successfully and started to compile the project. This indeed failed, because of the code changes between varlink-core:0.0.1 and varlink-core:0.2.0.

I found a few issues in the maven build of that project. I created a PR fixing them, I hope this helps: BBJip/varlink-java-maven-plugin-test#1.

Yes, thanks! Parts of the problem I already solved in the pom.fix file. The main issue here is that the not working pom.xml file is based on the steps described in this README: https://github.com/varlink/java/blob/develop/varlink-maven-plugin/README.md

Either I was misinterpreting the README or you should consider updating it. I can (as soon as I'm home) create a pull request for the README if you want.

Yes, I think the note about using the parent module should be removed.