This is a simple starter project for using Greenfoot outside of its dedicated IDE. Since more experience developers might want to use a more powerful IDE. This project is tailored to run in VSCode but should be usable in every Environment where Maven is supported.
To use this project you need to have Maven installed. You can install it via your package manager or download it from the official website.
If you have any problems with the installation, please refer to the official Maven installation guide.
After you have installed Maven do the following:
-
Clone this repository
git clone https://github.com/LeoTuet/greenfoot-maven-starter
-
Open the project in your favorite IDE
-
Install the dependencies
mvn clean install
To run the project use the following command:
mvn clean javafx:run
To debug the project use the following command:
mvn clean javafx:run@debug
#Note: The Greenfoot Window will not open until you attach the debugger
As soon as the project is Running go to the Debug tab in the Activity Bar
and execute the Attach Debugger
. The Greenfoot Window should now open and you can start debugging.
To update the Greenfoot version you need to download the newest version from greenfoot.jar
and bluej.jar
from the official release and then run:
mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file -Dfile="D:\projects\run-for-it\greenfoot.jar" -DgroupId="libs.org.greenfoot" -DartifactId="greenfoot" -Dversion="3.8.2" -Dpackaging="jar" -DlocalRepositoryPath="D:\projects\run-for-it" -DgeneratePom=true
mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file -Dfile="D:\projects\run-for-it\bluej.jar" -DgroupId="libs.org.bluej" -DartifactId="bluej" -Dversion="3.8.2" -Dpackaging="jar" -DlocalRepositoryPath="D:\projects\run-for-it" -DgeneratePom=true
Where -Dfile
is the path to the downloaded jar file and -Dversion
is the new version. -DlocalRepositoryPath
is the path to the local repository.
After that you just need to update the versions in the pom.xml
to the new ones and run
mvn clean install