首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >编译eclipse应用程序时,maven找不到javafx 11

编译eclipse应用程序时,maven找不到javafx 11
EN

Stack Overflow用户
提问于 2019-04-13 16:31:01
回答 1查看 412关注 0票数 0

我有一个使用JavaFX11的eclipse应用程序。由于缺乏更好的解决方案,我在/opt/javafx-sdk-11.0.2中安装了javafx,产品定义包含--module-path /opt/javafx-sdk-11.0.2/lib/ --add-modules=javafx.controls作为vm参数,.classpath包含以下几行:

代码语言:javascript
复制
<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看起来像这样:

代码语言:javascript
复制
  <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包含属性、repos和以下tycho构建插件配置:

代码语言:javascript
复制
  <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.version是11岁,但也尝试过10岁。奇怪的是,我记得我可以用maven编译它,但现在不能编译它。

错误:

代码语言:javascript
复制
[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)
EN

回答 1

Stack Overflow用户

发布于 2019-04-13 17:11:58

将javafx的所有jars文件放到项目的lib文件夹中,并在classpath中列出它们。但它看起来更像是一种变通而不是解决方案,我不知道如何设置产品的启动配置才能真正启动它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55663543

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档