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

JitPack fails building Pioneer: "invalid flag: -Xlint:all,-exports" #677

Closed
beatngu13 opened this issue Oct 8, 2022 · 5 comments · Fixed by #678
Closed

JitPack fails building Pioneer: "invalid flag: -Xlint:all,-exports" #677

beatngu13 opened this issue Oct 8, 2022 · 5 comments · Fixed by #678

Comments

@beatngu13
Copy link
Member

JitPack fails building Pioneer (v1.7.1), from the build log:

Build starting...
Start: Thu Oct 6 19:51:58 UTC 2022 8b68c77c4f3c
Git:
v1.7.1-0-g6a7a129
commit 6a7a129abc53a5670137e9f0e74b673ce59376be
Author: Mihály Verhás 
Date:   Tue May 24 17:48:10 2022 +0200

    Small fixes for Sonar (#640)
    

Init SDKMan
Found gradle
Gradle build script
Found gradle version: 7.4.
Using gradle wrapper
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Downloading https://services.gradle.org/distributions/gradle-7.4-bin.zip
.10%.20%.30%.40%.50%.60%.70%.80%.90%.100%

------------------------------------------------------------
Gradle 7.4
------------------------------------------------------------

Build time:   2022-02-08 09:58:38 UTC
Revision:     f0d9291c04b90b59445041eaa75b2ee744162586

Kotlin:       1.5.31
Groovy:       3.0.9
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          1.8.0_292 (Private Build 25.292-b10)
OS:           Linux 4.14.63-xxxx-std-ipv6-64 amd64

0m3.857s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~16.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
Getting tasks: ./gradlew tasks --all
Tasks: publishToMavenLocal,
Found javadoc task
Running: ./gradlew clean -Pgroup=com.github.junit-pioneer -Pversion=v1.7.1 -xtest assemble publishToMavenLocal
> Task :buildSrc:compileJava NO-SOURCE
> Task :buildSrc:compileGroovy NO-SOURCE
> Task :buildSrc:processResources NO-SOURCE
> Task :buildSrc:classes UP-TO-DATE
> Task :buildSrc:jar
> Task :buildSrc:assemble
> Task :buildSrc:compileTestJava NO-SOURCE
> Task :buildSrc:compileTestGroovy NO-SOURCE
> Task :buildSrc:processTestResources NO-SOURCE
> Task :buildSrc:testClasses UP-TO-DATE
> Task :buildSrc:test NO-SOURCE
> Task :buildSrc:check UP-TO-DATE
> Task :buildSrc:build
Maven publication 'maven' pom metadata warnings (silence with 'suppressPomMetadataWarningsFor(variant)'):
  - Variant jacksonApiElements:
      - Declares capability org.junit-pioneer:junit-pioneer-jackson:v1.7.1 which cannot be mapped to Maven
  - Variant jacksonRuntimeElements:
      - Declares capability org.junit-pioneer:junit-pioneer-jackson:v1.7.1 which cannot be mapped to Maven
These issues indicate information that is lost in the published 'pom' metadata file, which may be an issue if the published library is consumed by an old Gradle version or Apache Maven.
The 'module' metadata file, which is used by Gradle 6+ is not affected.
> Task :clean
> Task :generateModuleInfo
> Task :addDependenciesModuleInfo
> Task :compileJava FAILED
6 actionable tasks: 6 executed
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> invalid flag: -Xlint:all,-exports

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 13s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Archive: org.junit-pioneer:junit-pioneer:unspecified
Publication: org.junit-pioneer:junit-pioneer:unspecified
Build tool exit code: 0
Looking for artifacts...
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Looking for pom.xml in build directory and ~/.m2
Found artifact: org.junit-pioneer:junit-pioneer:unspecified
2022-10-06T19:53:03.067307525Z
Exit code: 0

⚠️ ERROR: No build artifacts found
Expected artifacts in: $HOME/.m2/repository/org/junit-pioneer/junit-pioneer/unspecified

I assume this is because we are building with 11 (targeting 8), whereas JitPack is using 8, which doesn't know the Xlint key exports.

@Bukama
Copy link
Member

Bukama commented Oct 8, 2022

But why our builds are green then?

@beatngu13
Copy link
Member Author

beatngu13 commented Oct 8, 2022

The lowest Java version we use in our build is 11, but we target Java 8 (i.e. bytecode version 52.0):

https://github.com/junit-pioneer/junit-pioneer/blob/main/build.gradle.kts#L30

However, there are parts of the Gradle script that can only be built with JDK 11+, e.g.:

https://github.com/junit-pioneer/junit-pioneer/blob/main/build.gradle.kts#L227

JitPack doesn't know that:

JitPack will compile projects using OpenJDK Java 8. See the example projects on how to set a different target version in your build file.

Maven projects that specify a target version in their pom will be built with that target version.

If your project uses Travis or Circle CI [no GitHub Actions 😕] then JitPack will read the lowest jdk version from yml file and use that to build.

Alternatively create a jitpack.yml file in the root of your repository and specify a jdk version:

jdk:
 - openjdk9

https://jitpack.io/docs/BUILDING/#java-version

Therefore, I think we can sidestep this issue by creating a jitpack.yml.

@Bukama
Copy link
Member

Bukama commented Oct 9, 2022

But why do we care, as we build with GitHub Actions?

@beatngu13
Copy link
Member Author

beatngu13 commented Oct 9, 2022

JitPack allows user to use unpublished (in terms of Maven Central) Pioneer versions, such as a specific branch or commit, without checking out the project and building it locally. In the past, we were trying to make JitPack work, too (e.g. #482).

Bukama pushed a commit that referenced this issue Oct 9, 2022
From the
[JitPack docs](https://jitpack.io/docs/BUILDING/#java-version):

>JitPack will compile projects using OpenJDK Java 8. See the example
>projects on how to set a different target version in your build file.
>
>Maven projects that specify a target version in their pom will be
>built with that target version.
>
>If your project uses Travis or Circle CI then JitPack will read the
>lowest jdk version from yml file and use that to build.
>
>Alternatively create a jitpack.yml file in the root of your
>repository and specify a jdk version:

This PR adds a `jitpack.yml`, specifying OpenJDK 11 to be used.

Closes: #677
PR: #678
@nipafx
Copy link
Member

nipafx commented Nov 8, 2022

@beatngu13 Should we not configure JitPack to run the modular build?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants