Eclipse IDE Install for Maptool 1.4 for a clean Windows PC

Developer discussion regarding MapTool 1.4

Moderators: dorpond, trevor, Azhrei

Forum rules
Posting now open to all registered forum users.
username
Dragon
Posts: 272
Joined: Sun Sep 04, 2011 7:01 am

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by username »

Jagged wrote:What version of Eclipse are you using?

I didn't have a problem with Luna and the STS plugin, but Oxygen and the built in Buildship tool does not work anything like as well.
Buildship Import objects to the top level project being called "Maptool" and then a sub project being called "maptool". But if you import the two sub projects separately you don't get the ability to run the gradle tasks from within Eclipse.

The Buildship plugin seems like quite a backward step imo :(


To add to the confusion, I used to have problems with Luna, so I switched to Oxygen. Problems vanished. Did you check that everything works on the command line, i.e. "./gradlew build" as it says in the readme? Most problems of this sort happened to me, when Java would auto-update a JRE, making it the default and supplanting an older JDK. That sort of error also shows on the CLI and is more comprehensible there.

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by Jagged »

If it is working for you with Oxygen are you using the Gradle import Buildship or the older STS plugin?

What approach are you taking to deal with the Maptool / maptool subproject issue? I am renaming the top level project.

I can build on the command line with either Gradle or the Gradle wrapper. Currently I get the cleanest install by using the Gradle Eclipse tasks and importing as a Git project.

I don't have any issues with the java versions as I always specify which version to run.

username
Dragon
Posts: 272
Joined: Sun Sep 04, 2011 7:01 am

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by username »

Eclipse:
Version: Oxygen.2 Release (4.7.2) Build id: 20171218-0600

OS:
Linux kabala 4.13.0-36-generic #40~16.04.1-Ubuntu SMP Fri Feb 16 23:25:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Buildship:
Buildship: Eclipse Plug-ins for Gradle 2.1.2.v20170807-1324 org.eclipse.buildship.feature.group Eclipse Buildship

Code:
MapTool [maptool-1.1.4.1-dev-branch]

I import the project as generic java project from GIT and later add the gradle nature. That creates the sub-projects "maptool" and "launcher". I then usually only work on either of those. Refreshing gradle project once in a while doesn't hurt. In particular it upgrades the "Gradle Tasks" pane, where you see the build task (among others). That's all I needed to do. Just doubleclicked on the build of the "maptool"-tree, this is the console:

Code: Select all

Working Directory: /home/miju/git/maptool-1/maptool
Gradle User Home: /home/miju/.gradle
Gradle Distribution: Specific Gradle version 2.10
Gradle Version: 2.10
Java Home: /usr/lib/jvm/java-8-openjdk-amd64
JVM Arguments: None
Program Arguments: None
Build Scans Enabled: false
Offline Mode Enabled: false
Gradle Tasks: build

:maptool:copyLibs UP-TO-DATE
:maptool:compileJava UP-TO-DATE
:maptool:processResources UP-TO-DATE
:maptool:classes UP-TO-DATE
:maptool:jar UP-TO-DATE
:maptool:startScripts UP-TO-DATE
:maptool:distTar UP-TO-DATE
:maptool:distZip UP-TO-DATE
:maptool:assemble UP-TO-DATE
:maptool:spotlessJavaCheck
:maptool:spotlessMiscCheck
:maptool:spotlessCheck
:maptool:compileTestJava UP-TO-DATE
:maptool:processTestResources UP-TO-DATE
:maptool:testClasses UP-TO-DATE
:maptool:test UP-TO-DATE
:maptool:check
:maptool:build

BUILD SUCCESSFUL

Total time: 6.899 secs

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by Jagged »

Okay, thats what I've been doing but I haven't been getting the Gradle tasks :(
Even after adding the Gradle perspective and doing an update.

:(

I have to edit the root project name to get Gradle tasks

username
Dragon
Posts: 272
Joined: Sun Sep 04, 2011 7:01 am

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by username »

I do remember that the tasks do not always open by themselves, you need to open the view explicitly-but that may depend on version. But you did find that, right? So I assume your pane stays blank. One of the curious things about eclipse is that it creates the sub-projects on top-level and if you have another (previous or newer) maptool ptoject, you get name collisions. That may keep your pane blank or-if it i a gadle project too-filled with the wrong stuff. I once had to work with a gradle project with many and pretty generic sub-project names and that caused a lot of problems, when I already had used those names. I moved to a different workspace after a while. So check that you have no name collisions, the way you describe your solution, it looks like you ran into something like that. (And the pane is sometimes slow, press F5 in there after an update is completed, judging from the lower right corner of the main window, where it shows the background work.)

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by Jagged »

Yeah, eclipse really needs to learn to cope with similarly named projects and sub-projects.

I also think some of the problem comes from the fact that you can only really test a "clean" install by deleting your Eclipse configuration directory as I note that some project specific references are remembered even after I delete the project from the workspace.

Anyway, I was doing this solely to update the install instructions but given that 1.4.1.9 will almost certainly return Maptool to a single project, I will hold off until then.

cheers!

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by Jagged »

I think the problem I am having with the Gradle Plugin is a known issue (https://github.com/eclipse/buildship/issues/511)

username
Dragon
Posts: 272
Joined: Sun Sep 04, 2011 7:01 am

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by username »

Looks like the main take away here is that you shouldn't attach gradle natures to the sub-projects but only to the root projects. That's what I did. It is not easy to get eclipse to drop the gradle nature and if that was wrongly applied, it may be even harder. Maybe add that to the recommendation.

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by Jagged »

Currently it's the Git import that assigns the Gradle nature. :-(

I am running into two acknowledged bugs :

1. Upon a Gradle refresh all the tasks grey out.
2. Upon a Gradle refresh the java compiler settings break because it incorrectly sets the java versions to 1.9 instead of 9

username
Dragon
Posts: 272
Joined: Sun Sep 04, 2011 7:01 am

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by username »

When you import the GIT project, eclipse asks you which wizard to use. (Was never automated to gradle, maybe autodetect.) Choose "generic java project", not "gradle". I had similar problems when introducing some colleagues to a gradle/git project. Eclipse gets overly smart that way. Only introduce gradle in a separate step. Haven't tried Java 9 at all.

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by Jagged »

I chose "Import Existing Eclipse Projects" having previously run from the command line:

Code: Select all

gradlew cleanEclipse eclipse

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by JamzTheMan »

One thing that helps is to add this to the build.gradle so it adds the proper natures and access rules when you do a `gradle eclipse` command.

Most of the time if I need to create a new workspace, I'll just use git desktop or CLI and clone the repo, run `gradle eclipse` then `Import Existing Eclipse Project` and it's good to go from there. If you are going to use Gradle and Eclipse, might as well automate as much as you can! :)

Code: Select all

apply plugin: 'eclipse'

eclipse {
   project {
      natures 'org.eclipse.buildship.core.gradleprojectnature'
      buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
   }

   classpath {
      file {
         withXml {
            def node = it.asNode()
            node.appendNode('classpathentry', [kind: 'con', path: 'org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER'])
         }
         whenMerged {
            entries.each { source ->
               if (source.kind == 'con' && source.path.startsWith('org.eclipse.jdt.launching.JRE_CONTAINER')) {
                  source.accessRules.add(new AccessRule('0', 'javafx/**'))
                  source.accessRules.add(new AccessRule('0', 'jdk/nashorn/api/**'))
               }
            }
         }
      }
   }
}
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

username
Dragon
Posts: 272
Joined: Sun Sep 04, 2011 7:01 am

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by username »

I usually go import GIT from Eclipse and then attach Gradle nature from within Eclipse. No CLI inbetween. (When delivering, I check that the CLI still works.)
Even if "apply eclipse" is missing; that can be added afterwards.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by JamzTheMan »

The reason I sometimes go to CLI is if the gradle build has errors, eclipse can barf on it badly. But ya, I have no issues going either CLI or in eclipse.

The advantage of adding the natures in the gradle is if you do a gradle clean, you would loose the natures unless you do another import or can add them via gradle menu. But adding the FX nature can be a pain afterwords. Having it all built in also guarantees someone can check out the project and run it as it should be.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Eclipse IDE Install for Maptool 1.4 for a clean Windows

Post by Jagged »

The main thing I have learnt through this is that Maven is so much better.
Give me a POM any day ;)

Post Reply

Return to “MapTool 1.4”