Issue using Gradle on Eclipse [message #1839562] |
Tue, 23 March 2021 23:11 |
Jared Riley Messages: 1 Registered: March 2021 |
Junior Member |
|
|
To be honest I can't completely figure out what my issue is, so a quick run-through of the process. I downloaded and extracted forge mod 12.2 (file name: forge-1.12.2-14.23.5.2854-mdk), then copied it and renamed the copied folder to Forge Mod Test (saved at "D:\Documents\Forge Mod Test"). On Eclipse, I import an Existing Gradle Project, with Project root directory "D:\Documents\Forge Mod Test" and click finish. When the project is done importing, I go to the Gradle Tasks bar, select fg_runs, and run "genEclipseRuns". When this is done, I go to IDE task folder and run "eclipse". Then I refresh the project by going to File, and selecting "Refresh". (I've tried running "eclipse" then "genEclipseRuns" and run into the same issues described next). With the project selected, I click File, Import, Launch Configurations, Browse, and select the folder at path "D:\Documents\Forge Mod Test". I select the "Forge Mod Test" folder, then select the next 2 files "runClient.launch" and "runServer.launch", then click finish. I select the drop-down menu next to the run button on eclipse, go to run configurations, and select runClient under the Java Application tab. Here, I go to environment and change "${MC_VERSION}" to "1.12" and click apply. I repeat that same process for runServer. Now I click run, and it tell me that "Errors exist inrequired project(s): Forge Mod Test". I proceed with launch and get the following error:
Error: Could not find or load main class net.minecraftforge.legacydev.MainServer
Caused by: java.lang.ClassNotFoundException: net.minecraftforge.legacydev.MainServer
From what I have read, there is an issue with dependencies, but running ".\gradlew build--refresh-dependencies" does not solve my issue. Below is a screenshot (and text) of the example code given by the forge MDK (the code has not been touched by my hands).
The error messages given on eclipse for the lines 3-8 are:
Multiple markers at this line
- The import net cannot be resolved
- The import org.apache cannot be
resolved
- The import net cannot be resolved
- The import net cannot be resolved
- The import net cannot be resolved
- The import net cannot be resolved
The rest of the errors are simply "xxx cannot be resolved to a type".
Mod Example Code:
package com.example.examplemod;
import net.minecraft.init.Blocks;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.Logger;
@Mod(modid = ExampleMod.MODID, name = ExampleMod.NAME, version = ExampleMod.VERSION)
public class ExampleMod
{
public static final String MODID = "examplemod";
public static final String NAME = "Example Mod";
public static final String VERSION = "1.0";
private static Logger logger;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
logger = event.getModLog();
}
@EventHandler
public void init(FMLInitializationEvent event)
{
// some example code
logger.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
}
}
I need to first figure out what exactly my problem is so I can look into the issue more. Thank you for the help.
|
|
|
Re: Issue using Gradle on Eclipse [message #1839563 is a reply to message #1839562] |
Tue, 23 March 2021 23:20 |
|
The "eclipse" Gradle task generates an updated .classpath file, which is what tells Eclipse where to find dependencies declared
through gradle. If it's not updating properly, you'd usually run the "cleanEclipse" task, and then the "eclipse" task. It sounds like you
have Buildship installed, and I thought it would handle that automatically, though.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03224 seconds