Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Buildship » Issue using Gradle on Eclipse(Issue using Eclipse to create a modification for Minecraft)
Issue using Gradle on Eclipse [message #1839562] Tue, 23 March 2021 23:11 Go to next message
Jared Riley is currently offline Jared RileyFriend
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 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4492
Registered: July 2009
Senior Member

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
Re: Issue using Gradle on Eclipse [message #1841742 is a reply to message #1839562] Thu, 27 May 2021 10:13 Go to previous messageGo to next message
Super Clickbaited is currently offline Super ClickbaitedFriend
Messages: 1
Registered: May 2021
Junior Member
I am having the same issue as well, I tried cleaneclipse and eclipse task and it didn't work. Any help please?
Re: Issue using Gradle on Eclipse [message #1845104 is a reply to message #1839562] Wed, 06 October 2021 21:05 Go to previous messageGo to next message
Pedro Torres is currently offline Pedro TorresFriend
Messages: 1
Registered: October 2021
Junior Member
Did you solve it? I have the exact same problem and I took the exact same steps to no avail.
Re: Issue using Gradle on Eclipse [message #1853921 is a reply to message #1845104] Sat, 23 July 2022 04:00 Go to previous message
Dieter Isolde is currently offline Dieter IsoldeFriend
Messages: 1
Registered: July 2022
Junior Member
I have the exact same problem and I took the exact same steps to no avail.Any help please?
Previous Topic:No Gradle Tasks appearing under projects in eclipse
Next Topic:Empty source directory removed from classpath on project import
Goto Forum:
  


Current Time: Mon Sep 23 23:00:49 GMT 2024

Powered by FUDForum. Page generated in 0.04536 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top