Is it possible to turn off (prevent activation) of a maven profile with gradle? - (unwanted maven profile active)

Viewed 379

I have an issue with the barcode library zxing.

compile('com.google.zxing:core:3.4.1') compile('com.google.zxing:javase:3.4.1')

The com.google.zxing core-3.4.1.pom is refering to a parent:

  <parent>
    <groupId>com.google.zxing</groupId>
    <artifactId>zxing-parent</artifactId>
    <version>3.4.1</version>
  </parent>

..and the zxing-parent-3.4.1.pom contains this snippet

  <profiles>
    <profile>
      <id>build-android</id>
      <activation>
        <property>
          <name>env.ANDROID_HOME</name>
        </property>
        <jdk>[,9)</jdk> <!-- Android won't necessarily work with JDK 9 -->
      </activation>
      <modules>
        <module>android-core</module>
        <module>android-integration</module>
        <module>android</module>
      </modules>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>${android.platform}</version>
            <scope>system</scope>
            <!-- ANDROID_HOME must be absolute, but redundant leading / may help Gradle Spring Boot plugin -->
            <systemPath>/${android.home}/platforms/android-${android.platform}/android.jar</systemPath>
          </dependency>
        </dependencies>
      </dependencyManagement>
    </profile>
    <profile>

Now the missing systemPath leads to this error:

Task :compileJava
Errors occurred while build effective model from C:\Users\eXtensia.gradle\caches\modules-2\files-2.1\com.google.zxing\core\3.4.1\d1e7c4667f9dcdda30d09f3df7d1b44f65c44336\core-3.4.1.pom:
'dependencyManagement.dependencies.dependency.systemPath' for com.google.android:android:jar must specify an absolute path but is ${env.ANDROID_HOME}/platforms/android-22/android.jar in com.google.zxing:core:3.4.1
Errors occurred while build effective model from C:\Users\eXtensia.gradle\caches\modules-2\files-2.1\com.google.zxing\javase\3.4.1\357121cdf3f89f63ddfaad18170612dcad0db947\javase-3.4.1.pom:
'dependencyManagement.dependencies.dependency.systemPath' for com.google.android:android:jar must specify an absolute path but is ${env.ANDROID_HOME}/platforms/android-22/android.jar in com.google.zxing:javase:3.4.1

Question

  • Gradle: is it possible to turn off this profile with gradle as android is not needed?
  • Gradle: Other ways to manipulate the downloaded .pom automatically via gradle to remove this profile?
  • Maven: Suggestion how to change the zxing-parent-3.4.1.pom that it will continue to run for android users, non android users and maven/gradle users? (there is already an issue and there are chances to get it changed.)
0 Answers
Related