Page 1 of 1

[Tutorial] How to Compile L2J Server and DataPack

Posted: Wed Feb 22, 2017 6:37 pm
by colonelcorn
So, ever since the github page got a DMCA request and was taken down all of the L2J stuff was moved to bitbucket, and subsequently the fully compiled versions of L2J Server and DataPack are no longer uploaded anywhere. Following the guide on how to compile these on the main L2J Page is currently outdated (as of 2-22-17) so I thought I would provide a new tutorial for those looking to get their hands on the bits.

If someone on the Dev team likes, I'd be happy to upload the datapack/server bits compiled somewhere for them - but I'm going to assume there is a good reason they have not done this themselves as I know they easily could.

I'm not a Java developer, so this may not be the "best" way to do this. But it's functional.

Last Updated: 2/22/17

1) First, we need to download the Java Development Kit (JDK). The version suggested by L2J seems to be 8. You can grab it here: http://www.oracle.com/technetwork/java/ ... 33151.html
Make sure you select "Accept Licence Agreement" and click on the download link for your platform. For this, I'm going to assume you're using 64bit Windows.
Image

Install the program, the defaults should be fine.

Restart your computer. This makes sure any java environment variables are fully setup in your system. Don't worry if you don't know what this is - just please RESTART your computer after installing.

2) Next, you want to install Eclipse Neon. You can find the download link here: https://www.eclipse.org/downloads/
Click on "Download 64 BIT" and the "Download" on the following page.
Image
Image

Install the program, again, the defaults should be fine.

3) Now you can go ahead and open up Eclipse.

Exit out of the "Welcome" window.
Image

Go to Window -> Show View -> Other and Select Git -> Git Repositories
Image
Image

In the window that has now been added to your workspace, select "Clone a Git Repository"
Image

Now, we're going to start with importing the L2J Server Repository. You can find the URI for the repository by going to https://bitbucket.org/l2jserver/l2j_server and clicking on "Clone".
Image

For now, the URI is: https://bitbucket.org/l2jserver/l2j_server.git - Paste that into eclipse (some other fields should auto-fill) and hit "Next".
Image

In the Branch Selection window, click "deselect all" and then just check the version you're looking for. For this tutorial, we'll do High Five, which is the "master" branch. Then hit next.
Image

Check the box "Import all existing Eclipse projects after clone finishes" and click finish. Also, make note of the directory the repository is going to be saved in. We'll need that later.
Image

This might take a few minutes to clone, be patient.

Once it's done, you should now have the repository in your "Git Repositories" window.
Image

Now, if you don't currently have the "Package Explorer" Pane open, you can open it by going to Window -> Show View -> Package Explorer
Image

Right click in the "Package Explorer" pane and select "import".
Image

Select Gradle -> Gradle Project and click Next.
Image

On the Welcome Page, click Next.
Image

In the "Project Root Directory" Browse to the top most portion of the git repository we downloaded. This was directory I asked you to make note of earlier. Click OK.
Image

Then Click "Finish". Wait for it to synchronize the workspace.
Image

4) Now, in the bottom your screen you should see a pane called "Gradle Tasks". If you don't see this, you can open it by going to Window -> Show View -> Other and selecting Grade -> Gradle Tasks.
Image
Image

Expand l2j_server -> Build. Right click on "build" and select "run gradle tasks".
Image

Let the process finish completely. A window should pop up with progress, but if it does not you can see it in the bottom right of the screen.

Once this is done, you can find the compiled files in a "build\distributions" folder in your git repository. Here is where mine was:
Image

That ZIP file is what you would normally download from the L2J site. All built yourself!

5) Now, repeat steps 3 & 4 above but select the Datapack Repository from bitbucket. You can find that here: https://bitbucket.org/l2jserver/l2j_datapack The URI is: https://bitbucket.org/l2jserver/l2j_datapack.git
Image

The datapack source is much larger, so expect all of the loading/building steps to take longer this time. This is normal. The compiled files can be found in the exact same way, but in your DataPack repository location.

I hope this helped! Let me know if you have any questions.

Re: [Tutorial] How to Compile L2J Server and DataPack

Posted: Sat Jul 14, 2018 6:09 am
by ROFLBBQ
Thank you very much. Only took a little over a year. ^^

Re: [Gradle Error] - [Tutorial] How to Compile L2J Server and DataPack

Posted: Sun Aug 12, 2018 6:58 am
by Con3ko
Thank You very much for that tutorial, It is well written and is very easy to understand. :clap: At first everything went smoothly and exactly as described for the "l2j_server" files. I was even able to successfully build the ZIP file with the Gradle Task.

But at step 5.) I was able to clone the L2j_datapack repository next to the L2j-server repository ("../L2j_git/l2j_server" & "../L2j_git/l2j_datapack"). But it threw the following error message, while I was trying to import the l2j_datapack as a Gradle project.


Synchronize Gradle projects with workspace failed due to an error connecting to the Gradle build.
The supplied build action failed with an exception.

Could not resolve all dependencies for configuration ':compileClasspath'.
Project : declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :L2J_Server.


What did i do wrong? Can anyone please help me with this? Am I the only one facing this problem?

Edit (2018.08.12):
Im using: Edit (2018.08.13):

Solution explanation:
After cloning the git-repositories the directory name of the l2j_server is written in lowercase, while the reference in the ../l2j_datapack/settings.gradle file is written with capital letters. Therefore editing the reference in the ../l2j_datapack/settings.gradle file solved the problem:

old ../l2j_datapack/settings.gradle

Code: Select all

include ':L2J_Server'
project(':L2J_Server').projectDir = new File(settingsDir, '../L2J_Server')
updated ../l2j_datapack/settings.gradle

Code: Select all

include ':L2J_Server'
project(':L2J_Server').projectDir = new File(settingsDir, '../l2j_server')

Re: [Tutorial] How to Compile L2J Server and DataPack

Posted: Fri Sep 04, 2020 8:37 pm
by rockkth
any chance to make a tutorial for people who do not use git but svn with subversion?
can't get eclipse to work,and all the old tutorials images are not working anymore. would be great help.

Re: [Tutorial] How to Compile L2J Server and DataPack

Posted: Fri Sep 04, 2020 10:23 pm
by Zoey76
rockkth wrote: Fri Sep 04, 2020 8:37 pm any chance to make a tutorial for people who do not use git but svn with subversion?
can't get eclipse to work,and all the old tutorials images are not working anymore. would be great help.
Why do you use SVN? Join us in Discord and we can help you get ready with Eclipse and Git.