Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8279327

Maven Assembly Plugin Issues Warnings for JavaFx 17 Onwards

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Java:
        openjdk version "11.0.2" 2019-01-15
        OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
        OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

      Operating System:
        Windows 10 Enterprise
        Version: 1909
        Installed on : 01/06/2021
        OS Build: 18363.1916
        
      Maven -version details:
        Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
        Maven home: C:\BuildTools\apache-maven-3.8.4
        Java version: 11.0.2, vendor: Oracle Corporation, runtime: C:\BuildTools\jdk-11.0.2
        Default locale: en_GB, platform encoding: Cp1252
        OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"


      A DESCRIPTION OF THE PROBLEM :
      When building a simple example which also uses the maven-assembly-plugin
      assembly warnings are output:

      [INFO] [INFO] --- maven-assembly-plugin:3.3.0:single (default) @ hellofx ---
      [INFO] Reading assembly descriptor: src/main/assembly/zip.xml
      [WARNING] Failed to build parent project for org.openjfx:javafx-controls:jar:17.0.1
      [WARNING] Failed to build parent project for org.openjfx:javafx-controls:jar:17.0.1
      [WARNING] Failed to build parent project for org.openjfx:javafx-graphics:jar:17.0.1
      [WARNING] Failed to build parent project for org.openjfx:javafx-graphics:jar:17.0.1
      [WARNING] Failed to build parent project for org.openjfx:javafx-base:jar:17.0.1
      [WARNING] Failed to build parent project for org.openjfx:javafx-base:jar:17.0.1

      JavaFX Releases 11 to 16 do not output the warning messages.

      REGRESSION : Last worked in version 16.0.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      A maven project is created with the following directory structure
          openjfx-assembly-warnings\data\someData.txt
      openjfx-assembly-warnings\scripts\run.bat
      openjfx-assembly-warnings\src\main\assembly\zip.xml
      openjfx-assembly-warnings\src\main\java\HelloFX.java
      openjfx-assembly-warnings\pom.xml

      The file contents are:

      someData.txt
        This file represents some data
        to be zipped up along with the
        application jar file

      run.bat
        java -cp ".;lib\*" HelloFX
        
      zip.xml
        <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
      http://maven.apache.org/xsd/assembly-1.1.2.xsd">
          <id>zip</id>
          <includeBaseDirectory>true</includeBaseDirectory>
          <formats>
            <format>zip</format>
          </formats>
          <fileSets>
            <fileSet>
              <directory>${project.basedir}/scripts</directory>
      <outputDirectory>/</outputDirectory>
            </fileSet>
      <fileSet>
              <directory>${project.basedir}/data</directory>
      <includes>
      <include>*</include>
              </includes>
      <outputDirectory>/data</outputDirectory>
            </fileSet>
          </fileSets>
          <dependencySets>
            <dependencySet>
              <outputDirectory>/lib</outputDirectory>
            </dependencySet>
          </dependencySets>
        </assembly>

      HelloFX.java
        import javafx.application.Application;
        import javafx.scene.Scene;
        import javafx.scene.control.Label;
        import javafx.scene.layout.StackPane;
        import javafx.stage.Stage;

        public class HelloFX extends Application {

          @Override
          public void start(Stage stage) {
            String javaVersion = System.getProperty("java.version");
            String javafxVersion = System.getProperty("javafx.version");
            Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
            Scene scene = new Scene(new StackPane(l), 640, 480);
            stage.setScene(scene);
            stage.show();
          }

          public static void main(String[] args) {
            launch();
          }
        }

      pom.xml
        <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
          <modelVersion>4.0.0</modelVersion>
          <name>hellofx</name>
          <groupId>com.test</groupId>
          <artifactId>hellofx</artifactId>
          <version>1.0.1</version>
          <packaging>jar</packaging>
          <url>http://maven.apache.org&lt;/url>
          <properties>
      <maven.compiler.source>11</maven.compiler.source>
      <maven.compiler.target>11</maven.compiler.target>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          </properties>
          <dependencies>
            <dependency>
              <groupId>org.openjfx</groupId>
              <artifactId>javafx-controls</artifactId>
              <version>17.0.1</version>
            </dependency>
          </dependencies>
          <build>
            <plugins>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                  <release>11</release>
                </configuration>
              </plugin>
              <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                  <execution>
                    <goals>
                      <goal>java</goal>
                    </goals>
                  </execution>
                </executions>
                <configuration>
                  <mainClass>HelloFX</mainClass>
                </configuration>
              </plugin>
         <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                  <execution>
                    <phase>package</phase>
                    <goals>
                      <goal>single</goal>
                    </goals>
                    <configuration>
                      <appendAssemblyId>false</appendAssemblyId>
                      <descriptors>
                        <descriptor>src/main/assembly/zip.xml</descriptor>
                      </descriptors>
                    </configuration>
                  </execution>
                </executions>
              </plugin>
            </plugins>
          </build>
        </project>

      To reporduce, run the maven command : mvn clean install

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      ----Expected Result----
      The expected result should be maven build output as follows:
      [INFO] Scanning for projects...
      [INFO]
      [INFO] --------------------------< com.test:hellofx >--------------------------
      [INFO] Building hellofx 1.0.1
      [INFO] --------------------------------[ jar ]---------------------------------
      [INFO]
      [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hellofx ---
      [INFO] Deleting C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\target
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hellofx ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\src\main\resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ hellofx ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 1 source file to C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\target\classes
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hellofx ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\src\test\resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ hellofx ---
      [INFO] No sources to compile
      [INFO]
      [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ hellofx ---
      [INFO] No tests to run.
      [INFO]
      [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hellofx ---
      [INFO] Building jar: C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\target\hellofx-1.0.1.jar
      [INFO]
      [INFO] --- maven-assembly-plugin:3.3.0:single (default) @ hellofx ---
      [INFO] Reading assembly descriptor: src/main/assembly/zip.xml
      [INFO] Building zip: C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\target\hellofx-1.0.1.zip
      [INFO]
      [INFO] --- maven-install-plugin:2.4:install (default-install) @ hellofx ---
      [INFO] Installing C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\target\hellofx-1.0.1.jar to C:\Users\T0082584\.m2\repository\com\test\hellofx\1.0.1\hellofx-1.0.1.jar
      [INFO] Installing C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\pom.xml to C:\Users\T0082584\.m2\repository\com\test\hellofx\1.0.1\hellofx-1.0.1.pom
      [INFO] Installing C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\target\hellofx-1.0.1.zip to C:\Users\T0082584\.m2\repository\com\test\hellofx\1.0.1\hellofx-1.0.1.zip
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 1.867 s
      [INFO] Finished at: 2021-12-23T10:03:24Z
      [INFO] ------------------------------------------------------------------------

      As can be seen no WARNING messages are output.


      ACTUAL -
      The actual result is producing WARNING messages with output as follows:

      [INFO] Scanning for projects...
      [INFO]
      [INFO] --------------------------< com.test:hellofx >--------------------------
      [INFO] Building hellofx 1.0.1
      [INFO] --------------------------------[ jar ]---------------------------------
      [INFO]
      [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hellofx ---
      [INFO] Deleting C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\target
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hellofx ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\src\main\resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ hellofx ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 1 source file to C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\target\classes
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hellofx ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\src\test\resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ hellofx ---
      [INFO] No sources to compile
      [INFO]
      [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ hellofx ---
      [INFO] No tests to run.
      [INFO]
      [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hellofx ---
      [INFO] Building jar: C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\target\hellofx-1.0.1.jar
      [INFO]
      [INFO] --- maven-assembly-plugin:3.3.0:single (default) @ hellofx ---
      [INFO] Reading assembly descriptor: src/main/assembly/zip.xml
      [WARNING] Failed to build parent project for org.openjfx:javafx-controls:jar:17.0.1
      [WARNING] Failed to build parent project for org.openjfx:javafx-controls:jar:17.0.1
      [WARNING] Failed to build parent project for org.openjfx:javafx-graphics:jar:17.0.1
      [WARNING] Failed to build parent project for org.openjfx:javafx-graphics:jar:17.0.1
      [WARNING] Failed to build parent project for org.openjfx:javafx-base:jar:17.0.1
      [WARNING] Failed to build parent project for org.openjfx:javafx-base:jar:17.0.1
      [INFO] Building zip: C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\target\hellofx-1.0.1.zip
      [INFO]
      [INFO] --- maven-install-plugin:2.4:install (default-install) @ hellofx ---
      [INFO] Installing C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\target\hellofx-1.0.1.jar to C:\Users\T0082584\.m2\repository\com\test\hellofx\1.0.1\hellofx-1.0.1.jar
      [INFO] Installing C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\pom.xml to C:\Users\T0082584\.m2\repository\com\test\hellofx\1.0.1\hellofx-1.0.1.pom
      [INFO] Installing C:\Users\T0082584\Desktop\Work\OPUS-G_Repositories\openjfx-archive-warnings\target\hellofx-1.0.1.zip to C:\Users\T0082584\.m2\repository\com\test\hellofx\1.0.1\hellofx-1.0.1.zip
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 1.851 s
      [INFO] Finished at: 2021-12-23T10:05:00Z
      [INFO] ------------------------------------------------------------------------

      ---------- BEGIN SOURCE ----------
      A maven project is created with the following directory structure
          openjfx-assembly-warnings\data\someData.txt
      openjfx-assembly-warnings\scripts\run.bat
      openjfx-assembly-warnings\src\main\assembly\zip.xml
      openjfx-assembly-warnings\src\main\java\HelloFX.java
      openjfx-assembly-warnings\pom.xml

      The file contents are:

      someData.txt
        This file represents some data
        to be zipped up along with the
        application jar file

      run.bat
        java -cp ".;lib\*" HelloFX
        
      zip.xml
        <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
      http://maven.apache.org/xsd/assembly-1.1.2.xsd">
          <id>zip</id>
          <includeBaseDirectory>true</includeBaseDirectory>
          <formats>
            <format>zip</format>
          </formats>
          <fileSets>
            <fileSet>
              <directory>${project.basedir}/scripts</directory>
      <outputDirectory>/</outputDirectory>
            </fileSet>
      <fileSet>
              <directory>${project.basedir}/data</directory>
      <includes>
      <include>*</include>
              </includes>
      <outputDirectory>/data</outputDirectory>
            </fileSet>
          </fileSets>
          <dependencySets>
            <dependencySet>
              <outputDirectory>/lib</outputDirectory>
            </dependencySet>
          </dependencySets>
        </assembly>

      HelloFX.java
        import javafx.application.Application;
        import javafx.scene.Scene;
        import javafx.scene.control.Label;
        import javafx.scene.layout.StackPane;
        import javafx.stage.Stage;

        public class HelloFX extends Application {

          @Override
          public void start(Stage stage) {
            String javaVersion = System.getProperty("java.version");
            String javafxVersion = System.getProperty("javafx.version");
            Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
            Scene scene = new Scene(new StackPane(l), 640, 480);
            stage.setScene(scene);
            stage.show();
          }

          public static void main(String[] args) {
            launch();
          }
        }

      pom.xml
        <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
          <modelVersion>4.0.0</modelVersion>
          <name>hellofx</name>
          <groupId>com.test</groupId>
          <artifactId>hellofx</artifactId>
          <version>1.0.1</version>
          <packaging>jar</packaging>
          <url>http://maven.apache.org&lt;/url>
          <properties>
      <maven.compiler.source>11</maven.compiler.source>
      <maven.compiler.target>11</maven.compiler.target>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          </properties>
          <dependencies>
            <dependency>
              <groupId>org.openjfx</groupId>
              <artifactId>javafx-controls</artifactId>
              <version>17.0.1</version>
            </dependency>
          </dependencies>
          <build>
            <plugins>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                  <release>11</release>
                </configuration>
              </plugin>
              <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                  <execution>
                    <goals>
                      <goal>java</goal>
                    </goals>
                  </execution>
                </executions>
                <configuration>
                  <mainClass>HelloFX</mainClass>
                </configuration>
              </plugin>
         <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                  <execution>
                    <phase>package</phase>
                    <goals>
                      <goal>single</goal>
                    </goals>
                    <configuration>
                      <appendAssemblyId>false</appendAssemblyId>
                      <descriptors>
                        <descriptor>src/main/assembly/zip.xml</descriptor>
                      </descriptors>
                    </configuration>
                  </execution>
                </executions>
              </plugin>
            </plugins>
          </build>
        </project>

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The only work around is to use a version of JavaFX prior to version 17

            abagarwal Abhinay Agarwal
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: