首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我无法在Raspberry pi上编译我的javafx maven项目

我无法在Raspberry pi上编译我的javafx maven项目
EN

Stack Overflow用户
提问于 2022-07-23 13:06:09
回答 1查看 161关注 0票数 0

我创建了一个java项目,它在我的mac上用"mvn编译“编译并运行得很好。但是,一旦我从Pi上的gitlab获取它,它就不会在linux上编译。

我查阅了许多页,但似乎没有一个适用于这个特定的问题。

有谁可以帮我?我会非常感激的!

错误:

代码语言:javascript
复制
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------------< SmartMirror:SmartMirror >-----------------------
[INFO] Building SmartMirror 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.816 s
[INFO] Finished at: 2022-07-23T14:54:44+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project SmartMirror: Could not resolve dependencies for project SmartMirror:SmartMirror:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.openjfx:javafx-controls:jar:${javafx.platform}:19-ea+9, org.openjfx:javafx-graphics:jar:${javafx.platform}:19-ea+9, org.openjfx:javafx-base:jar:${javafx.platform}:19-ea+9, org.openjfx:javafx-fxml:jar:${javafx.platform}:19-ea+9: Failure to find org.openjfx:javafx-controls:jar:${javafx.platform}:19-ea+9 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

POM.xml文件:

代码语言:javascript
复制
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>SmartMirror</groupId>
    <artifactId>SmartMirror</artifactId>
    <version>0.0.1-SNAPSHOT</version>


    <properties>
        <mainClass>main.Main</mainClass>
        <maven.compiler.source>1.9</maven.compiler.source>
        <maven.compiler.target>1.9</maven.compiler.target>
        <javafx.platform>linux</javafx.platform>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <shadedArtifactAttached>true</shadedArtifactAttached>
                            <transformers>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>main.Main</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.1</version>
            </plugin>

            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.8</version>
                <configuration>
                    <mainClass>Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.openjfx/javafx-controls -->
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>19-ea+9</version>
            <classifier>linux</classifier>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.openjfx/javafx-fxml -->
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>19-ea+9</version>
            <classifier>linux</classifier>
        </dependency>

        <dependency>
            <groupId>com.mashape.unirest</groupId>
            <artifactId>unirest-java</artifactId>
            <version>1.4.9</version>
        </dependency>
    </dependencies>

</project>

模块-info.java文件:

代码语言:javascript
复制
module SmartMirror {
    exports weather to javafx.graphics, javafx.fxml;
    exports main to javafx.graphics, javafx.fxml;
    
    opens weather to javafx.graphics, javafx.fxml;
    opens main to javafx.graphics, javafx.fxml;

    requires javafx.base;
    requires javafx.controls;
    requires javafx.fxml;
    requires transitive javafx.graphics;
    requires transitive json;
}

编辑:

到目前为止谢谢你的回答。尽管这个问题依然存在。还有其他想法吗?

EN

回答 1

Stack Overflow用户

发布于 2022-08-22 10:58:18

我在Raspberry Pi 3B (Raspberry Pi OS lite 32位)上使用了这个命令:

代码语言:javascript
复制
mvn -Djavafx.platform=linux-arm32-monocle clean compile

如果使用64位版本:

代码语言:javascript
复制
mvn -Djavafx.platform=linux-aarch64-monocle clean compile
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73091002

复制
相关文章

相似问题

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