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
Gradle build breakage with 3.3.1 release - ${env.ANDROID_HOME} #904
Comments
The build uses maven, not Gradle, and that works fine. |
The issue is that something in the POM is causing build problems for gradle projects consuming the Maven artifacts. I expect other users will encounter this issue since Gradle is widely used these days as an alternative to Maven. The problem started with the latest release and appears to be due to a change in the artifact packaging. Rolling back to the previous release fixes the problem. I am not familiar with the requirements for Android usage, but it seems that the POM was built assuming ${env.ANDROID_HOME} variable is defined which is certainly not the case for non-Android development environments. Gradle is unhappy since it is seeing the undefined variable in the systemPath for both artifacts. |
You're building your own project with Gradle, not this one? |
Correct. We are using ZXing as dependency for a gradle build. I believe your assessment of the problem is correct. While there is a growing overlap between gradle and maven functionality, interoperability is mainly at the artifact level. Gradle handles transitive dependencies and parent POMs well, but does not implement any of the maven build logic since it has its own groovy-based DSL and project model.. This sort of breakage is very unusual and not something we have seen in over 10 years of working with gradle. |
I see you have closed the issue. Is this something that can be addressed? We are using ZXing barcode functionality and were looking to implement some of the recent bug fixes. |
I did a little more digging. The error is actually a Spring Boot interoperability issue. The message is coming from the following Spring gradle plugin code which is analyzing the zxing POM.
|
Can you manually disable the profile that enables the Android modules? |
I don't believe so. The Spring Boot plugin makes use of master POM info to automatically pull in default versions for its supported frameworks. This allows the project to omit the version number of supported dependencies and automatically default to the versions tested with the current Spring Boot release. I believe the plugin is processing the POM files for all project dependencies and is choking on zxing since the environment variable value is unknown. I considered defining the Android home variable, but that would require it to be set across our build environment and at customer sites using our libraries due to transitive dependencies. The Spring Boot developers could presumably fix the issue, but that will not be a speedy process since we would need to wait for the issue to be fixed and for the next release. |
Does it help if the POM declared The error is actually kind of narrow, just noting that |
It is hard to say if that will work without diving into the Spring Boot plugin design. |
Here is a minimal gradle project that demonstrates the issue if you want to experiment. The project consists of two files: build.gradle in the project folder and a dummy class in the src/main/java. test.java (located in ./src/main/java/test.java) public class test { build.gradle (located in ./build.gradle) plugins { repositories { dependencies { defaultTasks 'build' bootRepackage { |
I added the redundant leading slash mentioned above. That should at least cure the exact error you see there. Don't know if it means others crop up. You could test by downloading the |
@extensia Did you try out the |
@mlaccetti I just tried it. The warning goes away and everything seems to work OK 👍 @srowen Will there be a |
I could do another release shortly. Let me back up and see if there are any other changes that need to get it. |
I still got the Warning with 3.3.2
|
I suspect it's because you're using Windows paths, and the hard-coded separator that's supposed to resolve this is Linux-style. Try using Linux paths? I kind of thought the build tools would still interpret them as expected on Windows. |
Is there any workaround for Windows users? I tried to change the environment variable ANDROID_HOME to /Users/<user name>/AppData/Local/Android/Sdk without functional result. I still have the error when I try to compile CAS Apereo.
|
I've run into the same issue trying to run Apereo CAS on a Windows machine with rest auth enabled:
The error:
|
Hm, if you manually edit the pom.xml file to use a backslash in that path, does it work? if so I wonder if we can reference the platform file separator here rather than hard code a slash? @nathangs |
Sean, thank you for getting back to me so quickly. I tried your suggestion to change the slashes to backslashes on line 722 of C:\Users<USER-PROFILE>.gradle\caches\modules-2\files-2.1\com.google.zxing\zxing-parent\3.3.2\4ad323c509da2eff69fe7f02ef0f4e5910509206\zxing-parent-3.3.2.pom:
Unfortunately this didn't work and I got the same error message about an incorrect absolute path. However, I did find something interesting: I was able to get CAS working by running |
What is CAS? is it related to android? you don't have to build any of the Android stuff if you don't want it. Did you set ANDROID_HOME? |
chrisptree and I are both using Apereo CAS. It doesn't have anything to do with Android as far as I can tell. They recommend using a WAR overlay deployment method that uses a maven or gradle script to download any needed dependencies (zxing being one of them) then builds the CAS application along with customizations you have made. I have the Android 22 SDK installed and the ANDROID_HOME environment variable set to
|
Oh right, per above, maybe Gradle doesn't parse the bit that says to skip the Android parts unless ANDROID_HOME is set. You can just chop the modules out of your build manually, too. |
If some one else got the same problem, you could try this |
If I could I would reopen. Workarounds
|
3.3.0 was (IIRC) the last Java 7 version, I don't know. Surely you can at worst just remove this profile, or hard-code activating it? Maven lets you disable profiles with |
thanks for fast reply. The maven command line won't help me here because I can not get this done with gradle. There are 2 conditions for the build-android profile: |
I mean, I could make the profile 'opt-in' by removing the activation. That's no big deal. But I don't see why you would not just remove the profile if you need to deactivate it in Gradle? just edit pom.xml |
that would be great.
Of course I can modify the pom.xml. But the issue is I have to do it again and again manually whenever I clean or build new. Gradle is resolving the dependencies. I just delcare The biggest disadvantage would be that I can not run a build on a build server (like jenkins) because I have no chance to interrupt between the pom download and the compile. |
this is still an issue in 3.5.0 |
Errors occurred while build effective model from C:\Users\user.gradle\caches\modules-2\files-2.1\com.google.zxing\core\3.5.0\d23101cb84e79a015b8ffd0b51b8cebfe27d1a1c\core-3.5.0.pom: @srowen this still exist in 3.5.0 |
Folks: read above. There is no problem with the Maven build. This is a Gradle issue if anything in how it reads POMs. You can edit the POM if you want. |
Strange this continues to be a source of problems. I am using the 3.5.0 core and javase artifacts in a Java server project using Gradle 7.4.2. The problem I originally reported appears to have been resolved. Here is my dependency declaration for reference. api('com.google.zxing:javase:3.5.0') Depending on your requirements you might also consider using Okapi Barcode. It is actively maintained and supports many barcode formats. |
@srowen No the gradle users can't edit the POM because everything is handled by gradle from this point. Manually for every build yes but not possible in build integration tools to interrupt in this process. (see my comment here: #904 (comment)) Your suggestion here would help:
|
Would it not be more productive to lobby Gradle to support this aspect of POM files? This will be a problem for Gradle for more than this project. Just seems like the wrong place to pursue |
I recently upgraded a Java server application to 3.3.1 and am seeing the following error messages when resolving dependencies. It appears the system paths containing ${env.ANDROID_HOME} are causing issues with gradle. We are using gradle 4.2.1 with the following dependencies:
compile('com.google.zxing:core:3.3.0')
compile('com.google.zxing:javase:3.3.0')
The text was updated successfully, but these errors were encountered: