Giter VIP home page Giter VIP logo

Comments (28)

AlmasB avatar AlmasB commented on June 7, 2024

Try right-click and rebuild on resources in your IDE. Sometimes, IDEs do not copy resources correctly.

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

Sadly did not work, error still persists.

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

I did a little bit of testing. If I do this:

 File test = new File("src/main/assets/textures/ship5.png");

 String str = test.getAbsolutePath();

FileInputStream input = new FileInputStream(str);
Image img = new Image(input);
ImageView view = new ImageView(img);

var ship = FXGL.entityBuilder(data)

          
                .viewWithBBox(view)
                .build();
                

Then it works, and the image gets added correctly. As you can see from the path, I have my assets in the main folder. Put using

File test = new File("src/main/resources/assets/textures/ship5.png");

Works also. Maybe this helps in narrowing down the error

from fxgl-mavengradle.

AlmasB avatar AlmasB commented on June 7, 2024

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

Please excuse the question, but I am rather new to java - What commands would I need to run? And should I run them from the terminal inside Intellij for instance?

from fxgl-mavengradle.

AlmasB avatar AlmasB commented on June 7, 2024

No worries.

  1. Get apache maven binary zip.
  2. Set JAVA_HOME environment variable to point to your jdk 11+. If you haven't done this before, have a look online on how to set it based on your OS.
  3. Then run from the terminal (e.g. Linux terminal / Git bash) -- don't use IDE, as it will help us see where the error is coming from
mvn javafx:run

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

Ok, thanks for the patience. I will look into it when I have some spare time - got 3 exams upcoming in the next few days, so I am somewhat lacking in free time.

But I am curious to get to the bottom of this, so I'll test this when I can

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

Got around to testing what you asked. Running the command produced a build failure:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.122 s
[INFO] Finished at: 2021-01-18T10:03:16+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'javaFX' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\Daniel K.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [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/NoPluginFoundForPrefixException

from fxgl-mavengradle.

AlmasB avatar AlmasB commented on June 7, 2024

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

grafik

Hope the screenshot helps.

from fxgl-mavengradle.

AlmasB avatar AlmasB commented on June 7, 2024

Hmm, you need to run this inside the project directory.

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

oh... well sorry for the noob thing... will do

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

Hmm, you need to run this inside the project directory.

Do I have to be inside src? or just inside the directory?

from fxgl-mavengradle.

AlmasB avatar AlmasB commented on June 7, 2024

Inside the top-level directory (FXGL-MavenGradle), i.e. where pom.xml is located.

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

ok, was in the right place then, same error - should I post the complete output from GitBash?

from fxgl-mavengradle.

AlmasB avatar AlmasB commented on June 7, 2024

yes, please. A screenshot will do

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

grafik
grafik

from fxgl-mavengradle.

AlmasB avatar AlmasB commented on June 7, 2024

Please make sure that you are using the latest pom.xml from this repository.

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

Updated the POM, had to change the source inside it to "14", to get further, still get this error:

grafik

from fxgl-mavengradle.

AlmasB avatar AlmasB commented on June 7, 2024

Have you made any changes to the project? If so, it might be best to simply download the latest copy of this directory and run maven.

from fxgl-mavengradle.

AlmasB avatar AlmasB commented on June 7, 2024

Here's "reference" output:

Almas@Ascension MINGW64 ~/almas_workspace/java/FXGL-MavenGradle (master)
$ mvn -v
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T19:33:14+01:00)
Maven home: C:\Users\Almas\almas_program_files\apache-maven
Java version: 14.0.2, vendor: Oracle Corporation, runtime: C:\Users\Almas\almas_program_files\JDK14
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Almas@Ascension MINGW64 ~/almas_workspace/java/FXGL-MavenGradle (master)
$ mvn javafx:run
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.almasb:Drop >---------------------------
[INFO] Building Drop 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> javafx-maven-plugin:0.0.5:run (default-cli) > process-classes @ Drop >>>
[INFO]
[INFO] --- kotlin-maven-plugin:1.4.10:compile (compile) @ Drop ---
[WARNING] No sources found skipping Kotlin compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Drop ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ Drop ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to C:\Users\Almas\almas_workspace\java\FXGL-MavenGradle\target\classes
[INFO]
[INFO] <<< javafx-maven-plugin:0.0.5:run (default-cli) < process-classes @ Drop <<<
[INFO]
[INFO]
[INFO] --- javafx-maven-plugin:0.0.5:run (default-cli) @ Drop ---
10:22:41.923 [JavaFX Application Thread] INFO  Engine               - FXGL-11.12 (11.12.2020 08.51) on WINDOWS (J:14.0.2 FX:15)
10:22:41.924 [JavaFX Application Thread] INFO  Engine               - Source code and latest versions at: https://github.com/AlmasB/FXGL
10:22:41.924 [JavaFX Application Thread] INFO  Engine               -              Join the FXGL chat at: https://gitter.im/AlmasB/FXGL
10:22:42.503 [FXGL Background Thread 1 ] WARN  FXGL.DefaultMenu     - FXGLDefaultMenu is not designed for resolutions < 800x600
10:22:42.631 [FXGL Background Thread 1 ] INFO  FXGLApplication      - FXGL initialization took: 0.402 sec
10:22:43.390 [FXGL Background Thread 4 ] INFO  FXGLApplication      - Game initialization took: 0.675 sec
10:22:43.529 [FXGL Background Thread 2 ] INFO  UpdaterService       - Your current version:  11.12
10:22:43.529 [FXGL Background Thread 2 ] INFO  UpdaterService       - Latest stable version: 11.11
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.174 s
[INFO] Finished at: 2021-01-18T10:22:46Z
[INFO] ------------------------------------------------------------------------

Almas@Ascension MINGW64 ~/almas_workspace/java/FXGL-MavenGradle (master)
$

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

Okay, did some testing.

First, yes I did use this template to develop my project, so I added some things.

I pulled a fresh copy of the repo just now - maven runs without any issues, gradle still hast the texture loading problem.

Edit: Did some further testing, modified the POM to fit my project (was pointing at wrong main class).
Now, Maven compiles without errors finding all assets, gradle still, as stated above cannot find any assets

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

Solved the issue... A malformed modul_info.java was causing gradle to make problems. Solved it by deleting it - brutal, but it worked. Now gradle run works without error, and finds all assets. Could you just tell me if this module info file is needed, and how I would need to configure it correctly?

/**
 * @author Almas Baimagambetov ([email protected])
 */
open module drop.main {  //<-- what needs to be but there? Name of my main class? or something else?
    requires com.almasb.fxgl.all;
    requires annotations;
    requires javafx.media;
}

if not, this issue is resolved. :)

from fxgl-mavengradle.

AlmasB avatar AlmasB commented on June 7, 2024

Thanks for letting me know.

module-info is needed for generating jlinked platform images for deployment. The one provided should be fine, as it works with maven. Will investigate the gradle build later.

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

I renamed the package and main Class, so maybe the name of my class or package causes the problem. If you need any more info let me know!

from fxgl-mavengradle.

AlmasB avatar AlmasB commented on June 7, 2024

Should work now. If you'd like to test it out, please get a fresh copy of the repo and run with gradle instructions in README

from fxgl-mavengradle.

LordSyd avatar LordSyd commented on June 7, 2024

updated the repo that I had local, works fine now.

I think that I botched something when using this repo as a starting point for my project. By renaming the Main Class and the package gradle got very unhappy - I thought I changed all the importand config files, but the module_info.java file continued to cause a problem. Still do not know what would be the correct way to configure this file.

In any case, the issue is solved, If there is nothing else you want me to test you can close this issue. Thanks for your patience!

from fxgl-mavengradle.

AlmasB avatar AlmasB commented on June 7, 2024

I often encounter issues with gradle myself, which is why I prefer maven. Good to know the updated gradle build works fine now. Thanks.

from fxgl-mavengradle.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.