maven не может найти javafx 11 при компиляции приложения eclipse - PullRequest
0 голосов
/ 13 апреля 2019

У меня есть приложение eclipse, использующее javafx 11. Из-за отсутствия лучшего решения я установил javafx в /opt/javafx-sdk-11.0.2, определение продукта содержит --module-path /opt/javafx-sdk-11.0.2/lib/ --add-modules=javafx.controls в качестве аргументов vm, а .classpath содержит следующие строки:

<classpathentry kind="lib" path="/opt/javafx-sdk-11.0.2/lib/javafx.base.jar"/>
<classpathentry kind="lib" path="/opt/javafx-sdk-11.0.2/lib/javafx.controls.jar"/>
<classpathentry kind="lib" path="/opt/javafx-sdk-11.0.2/lib/javafx.graphics.jar"/>

Мой pom.xml выглядит следующим образом:

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.rulez.magwas</groupId>
    <artifactId>zenta3</artifactId>
    <version>3.0.0-SNAPSHOT</version>
  </parent>

  <groupId>zenta3-editor</groupId>
  <artifactId>org.rulez.demokracia.zenta3.editor</artifactId>
  <packaging>eclipse-plugin</packaging>

  <build>
    <plugins>
        <plugin>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>0.0.1</version>
            <configuration>
                <mainClass>org.openjfx.App</mainClass>
            </configuration>
        </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <release>${jdk.version}</release>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.6.0</version>
        <executions>
          <execution>
            <goals>
              <goal>java</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <mainClass>ZentaApplication</mainClass>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>11.0.2</version>
    </dependency>
</dependencies>

</project>

Родительский pom содержит свойства, репозитории и следующие конфигурации подключаемых модулей сборки Tycho:

  <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-packaging-plugin</artifactId>
    <version>${tycho-version}</version>
    <configuration>
      <archive>
        <manifestEntries>
          <Bundle-RequiredExecutionEnvironment>${jdk.full.version}</Bundle-RequiredExecutionEnvironment>
        </manifestEntries>
      </archive>
    </configuration>
  </plugin>
  <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-maven-plugin</artifactId>
    <version>${tycho-version}</version>
    <extensions>true</extensions>
  </plugin>
  <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>target-platform-configuration</artifactId>
    <version>${tycho-version}</version>
    <configuration>
      <executionEnvironment>${jdk.full.version}</executionEnvironment>
      <dependency-resolution>
        <extraRequirements>
          <requirement>
            <type>eclipse-plugin</type>
            <id>org.eclipse.osgi.compatibility.state</id>
            <versionRange>0.0.0</versionRange>
          </requirement>
        </extraRequirements>
      </dependency-resolution>
      <environments>
        <environment>
          <os>linux</os>
          <ws>gtk</ws>
          <arch>x86_64</arch>
        </environment>
        <environment>
          <os>win32</os>
          <ws>win32</ws>
          <arch>x86_64</arch>
        </environment>
        <environment>
          <os>macosx</os>
          <ws>cocoa</ws>
          <arch>x86_64</arch>
        </environment>
      </environments>
    </configuration>
  </plugin>
</plugins>

jdk.version11, но попробовал и с 10.Странная вещь, которую я помню, я мог скомпилировать ее с maven, но не могу заставить ее скомпилировать сейчас.

Ошибка:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.4.0:compile (default-compile) on project org.rulez.demokracia.zenta3.editor: Compilation failure: Compilation failure: 
[ERROR] /project/mag/Zenta/zenta3/ui/src/main/java/org/rulez/demokracia/zenta3/editor/parts/handles/DeleteElementHandlePart.java: 
[ERROR]     package org.rulez.demokracia.zenta3.editor.parts.handles;
[ERROR]     ^
[ERROR] The type javafx.scene.paint.Color cannot be resolved. It is indirectly referenced from required .class files
[ERROR] /project/mag/Zenta/zenta3/ui/src/main/java/org/rulez/demokracia/zenta3/editor/parts/handles/DeleteElementHandlePart.java:[17] 
[ERROR]     public class DeleteElementHandlePart extends AbstractHandlePart<Group> {
[ERROR]                                                                     ^^^^^
[ERROR] Group cannot be resolved to a type
[ERROR] 2 problems (2 errors)

1 Ответ

0 голосов
/ 13 апреля 2019

Поместил все jar-файлы javafx в папку lib проекта и перечислил их в classpath. Но это больше похоже на обходной путь, чем на решение, и я не могу понять, как настроить конфигурацию запуска продукта так, чтобы он мог запускаться.

...