It is currently 23 Apr 2024, 18:10
   
Text Size

Help with compiling Forge snapshots for myself.

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Help with compiling Forge snapshots for myself.

Postby ZappaZ » 26 Sep 2015, 21:53

Hello, since both the snapshot locations have not updated in a while I decided to take a crack at compiling my own using the Forge:How to Get Started Developing Forge and after about three hours I've realized I might need some help.

FYI I've had zero experience with SVN, Eclipse or Maven before. There is a TL:DR if you don't want to read about my adventures.

This is what I've managed so far:

1. Install and test Java, Check
2. Install and test Subversion. Check. But here was the first snag, the .zip after the link is only the source, took me a while to figure out( :roll: ) and then I had to test 3 of the windows versions before I found SlikSVN that passed the command line test (Do you have to install them in program files or something?)
3. Install and test Maven. No. Seems I don't need this if I only want to compile something for myself, wierd that it seems so important later.. (Nitpick: here it tells me to skip ahead to the m2e plugin if I'm not planning on being part of the development process, but you still have to install Eclipse..)
4. Install Eclipse. Check. I might have gone wrong here, the instructions are for 3.7 but I installed 4.5 the latest stable release, seemed sensible and the guide recommended it, this might explain some of the strange things ahead.
5. Installing Subclipse. Check. There is something wierd here, if I install version 1.6 I two steps below have to search for a m2e-subclipse svn connector, this is not in the list anymore? So I had to go back and install version 1.8 (1.7? confusing..)
6. Install m2e. Check. The guide asks for m2e - Maven Integration for Eclipse but I only found m2e - Maven Integration for Eclipse (Includes Incubating components), sometimes such things matters but this was the closest alternative so I choose this.
7. Install m2e Plugin Connectors. Check. (Comments on step 5)
8. Checkout the SVN Repository. Check. This is where I had alot of trouble, had to go back and change stuff on the earlier steps to get past this.
8.5 First time checkout. Hmm, I got no errors? I think.. (Still did the Maven Update step.)
9. Building and Exporting the Project. This is where I'm stuck right now, I think that this is where some of the changes between Eclipse 3.7 and 4.5 shows up. See picture below for my problem, I can't get the Run as -> Java Application choice :)


I also tried the IntelliJ program but the instructions to download something from SVN seems to be missing, I ended up using the folder and pom.xml file that Eclipse managed to download but after step 3 in the wiki guide I had to resort to guesswork since it seems to be outdated :)

So anyway, does anyone have any tips for how I should proceed? Is there an easier way or am I missing something obvious? (It's really late where I'm from haha.)

Bottom line is that I would really like to be able to compile this on my own and not rely on others bandwidth and free time.

TL:DR
The WIKI guide seems to be a bit outdated, does anyone have some simpler instructions?
Attachments
Capture.JPG
Step 9
ZappaZ
 
Posts: 92
Joined: 26 Jul 2014, 05:37
Has thanked: 26 times
Been thanked: 2 times

Re: Help with compiling Forge snapshots for myself.

Postby friarsol » 26 Sep 2015, 22:12

I'd recommend using IntelliJ Idea over Eclipse. It's much simpler for the whole process. The Wiki for that was updated pretty recently: http://www.slightlymagic.net/wiki/Forge ... e#IntelliJ

and then:
http://www.slightlymagic.net/wiki/Forge ... IntelliJ_2
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Help with compiling Forge snapshots for myself.

Postby ZappaZ » 26 Sep 2015, 23:24

Thanks!

Does it matter if I use Subversion 1.6 or 1.7 when I checkout from SVN?

There seems to be quite a few steps missing between 3. and 4. in the guide, but I guess it's only alot of Next/Ok and no settings needs to be changed.

On step 5.
On the very right click on Maven Projects and then on the very first icon of the expandable tab (then when hover over it reads as Reimport all Maven Projects)
I honestly can't figure out how to go from here, sorry. I'll keep fiddling but if you have any ideas :wink:
Attachments
Capture.JPG
ZappaZ
 
Posts: 92
Joined: 26 Jul 2014, 05:37
Has thanked: 26 times
Been thanked: 2 times

Re: Help with compiling Forge snapshots for myself.

Postby friarsol » 26 Sep 2015, 23:50

ZappaZ wrote:Thanks!

Does it matter if I use Subversion 1.6 or 1.7 when I checkout from SVN?
Nah, if you are only checking out code your svn shouldn't matter.

There seems to be quite a few steps missing between 3. and 4. in the guide, but I guess it's only alot of Next/Ok and no settings needs to be changed.

On step 5.
On the very right click on Maven Projects and then on the very first icon of the expandable tab (then when hover over it reads as Reimport all Maven Projects)
I honestly can't figure out how to go from here, sorry. I'll keep fiddling but if you have any ideas :wink:
The one error message suggests you didn't add the pom file as a Maven project? You probably want that. Also if you click on fix it in the balloon it should give you a way to point IntelliJ to your local svn location. It's not a big deal though, since you obviously have the code. You just won't be able to commit from inside IntelliJ
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Help with compiling Forge snapshots for myself.

Postby ZappaZ » 27 Sep 2015, 00:51

One step at a time! Only thing left to do is compile it I guess.

7. Click on Run -> Edit Configurations
(Fill in 2 forms, click OK)
8. Now you should be able to start the application clicking on the Run Icon (green triangle) or Run -> Run Main;

Greyed out.. I managed to get a JUnit test to run and pass while playing around but other than that, no luck.
Attachments
Capture.JPG
ZappaZ
 
Posts: 92
Joined: 26 Jul 2014, 05:37
Has thanked: 26 times
Been thanked: 2 times

Re: Help with compiling Forge snapshots for myself.

Postby friarsol » 27 Sep 2015, 01:49

Use classpath of module also needs to be forge-gui-desktop in the configuration
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Help with compiling Forge snapshots for myself.

Postby ZappaZ » 27 Sep 2015, 10:29

Nice, I got it to run finally, thanks man!

If someone else reads this later, I had to do the following at this point:

Run -> Edit configurations
Instead of choosing application from below the Defaults submenu as I had done before I had to click the green + in the top left corner and THEN choose Application. After this I was able to Run with no problem, Forge even recognised my normal decks and card art.

I have three closing questions if you don't mind Sol:

Is Build -> Rebuild Project what I use to pull the latest files from the SVN?
Is there any way to see the revision number from inside IntelliJ or Forge or do I have to check http://svn.slightlymagic.net/forge/trunk/ every time I Run the code?
How do I get it to actually give me a snapshot file that I can move to my other computer?
ZappaZ
 
Posts: 92
Joined: 26 Jul 2014, 05:37
Has thanked: 26 times
Been thanked: 2 times

Re: Help with compiling Forge snapshots for myself.

Postby friarsol » 27 Sep 2015, 12:33

ZappaZ wrote:Is Build -> Rebuild Project what I use to pull the latest files from the SVN?
Is there any way to see the revision number from inside IntelliJ or Forge or do I have to check http://svn.slightlymagic.net/forge/trunk/ every time I Run the code?
How do I get it to actually give me a snapshot file that I can move to my other computer?
1. Inside IntelliJ you can update your svn project by right clicking on the root Forge directory, going to Subversion, and clicking on Update Directory. Then you rebuild your project when the latest files have been sync'd. (I think you can also do File->Synchronize which is a bit simpler if it works)

2. Right-click on Forge root directory folder, select Subversion, then Show History. If you just ran #1 the top most update should be bolded and the first column has the number of the revision. Otherwise, you may have to scroll to find the bolded row, which is the revision you are updated to.

3. Sorry, I don't think it's complex to do, I just never do it so I don't have directions for you. It's something do with the Maven directives, maybe one of the other devs can give you an idea.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Help with compiling Forge snapshots for myself.

Postby ZappaZ » 27 Sep 2015, 15:43

Thanks again and sorry about the handholding!
ZappaZ
 
Posts: 92
Joined: 26 Jul 2014, 05:37
Has thanked: 26 times
Been thanked: 2 times

Re: Help with compiling Forge snapshots for myself.

Postby Agetian » 27 Sep 2015, 16:06

About making a transferable snapshot - it's actually rather easy to do:
1) Take the compiled .jar file from "trunk/forge-gui-desktop/target". Place it in the folder where you want your snapshot to be (make a new folder first if necessary).
2) Run "mkzip.sh" (if on a *nix system) in "trunk/forge-gui/res/cardsfolder" to make the archive of card scripts. If not on *nix (e.g. on Windows), then make a zip archive named cardsfolder.zip containing all the subfolders (a,b,c,...,z) in "trunk/forge-gui/res/cardsfolder" using your preferred method. Either way, once that's done, take the resulting cardsfolder.zip and place it into the "res/cardsfolder" subfolder of your snapshot folder.
3) Copy the other folders (ai, blockdata, cube, defaults, ......., sound) from "trunk/forge-gui/res" to the "res" subfolder of your snapshot folder.

That's pretty much it.
Enjoy! :)

Btw, speaking of using Java IDEs - personally I'm using NetBeans and I found it to be really user-friendly when it comes to developing Forge. In fact, the first time I tried it I was surprised how easy it was to set up NetBeans for Forge (basically, it's just "check out the repository + open the project + hit Compile", no need to mess around with some plugins and whatnot like in Eclipse). Haven't tried IntelliJ, but was really satisfied with NetBeans (especially after following a multi-page manual to set up a dev environment for Forge in Eclipse a couple times O_o ).

- Agetian
Agetian
Programmer
 
Posts: 3472
Joined: 14 Mar 2011, 05:58
Has thanked: 677 times
Been thanked: 561 times

Re: Help with compiling Forge snapshots for myself.

Postby KrazyTheFox » 27 Sep 2015, 16:57

There's a Maven goal that builds a snapshot, eliminating all the manual steps. Run this from your root forge project directory.

Code: Select all
mvn clean -U -B install -P windows-linux

Replace "windows-linux" with "osx" if you're playing on OSX. You'll find a folder in "forge-dir/forge-gui-desktop/target/" called "forge-gui-desktop-[version]-SNAPSHOT" that has everything you need in it.
User avatar
KrazyTheFox
Programmer
 
Posts: 725
Joined: 18 Mar 2014, 23:51
Has thanked: 66 times
Been thanked: 226 times

Re: Help with compiling Forge snapshots for myself.

Postby Agetian » 27 Sep 2015, 16:59

Interesting, I don't think I've ever used that :) Thanks for the heads-up! :)
Agetian
Programmer
 
Posts: 3472
Joined: 14 Mar 2011, 05:58
Has thanked: 677 times
Been thanked: 561 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 36 guests


Who is online

In total there are 36 users online :: 0 registered, 0 hidden and 36 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 36 guests

Login Form