Jump to content

Exporting jars from multiple main classes


Recommended Posts

Posted (edited)
14 minutes ago, Zummy said:

Hey guys I'm having difficulties with exporting multiple jars.

I have a package containing the main classes of a few scripts, now I'm trying to create artifacts from each of those main classes.

I'm not sure how to set that up, I'm using Intellij btw. Thanks!


Make each script it's own module, then it's easy to create a separate artifact for each one.

Create a new project (you could just name it something like ZummyScripts)

5fb3df52655d135d9e30714a9fc87714.png.97671db4e559409552d9cee4d3c8b63a.png

Delete the automatically created module

0801484275ac0c114a489ade59bb6af7.png.892415703ec24ce5f338733f813dac84.png

When you want to create a new script, go to File -> New -> Module..

Set the Module name to your script name, make sure the content root and file location is correct

c80d0971c47cdfea0b49de931c28174b.png.1670157ade8c4fefd29626961d164787.png

 

229ac23b5183f2a90f56e37054e1091b.png.c951a5c24230b513acd04e89692caf6f.png

Repeat the process whenever you want to add a new script

a2919ad2d862107635e5376fc2172dab.png.9779a2c32586ddbd4b78cf86bc7366b1.png

Now when you go to create an artifact, you will see each module in the available elements section. Just select which one you want for this .jar

9757881a9a96fa5d9eb415831f156a93.thumb.png.8ceb5bdbb387a4e02fb38351ec47a816.png

 

 

 

Edited by Explv
  • Like 1
Posted
4 minutes ago, Explv said:


Make each script it's own module, then it's easy to create a separate artifact for each one.

Create a new project (you could just name it something like ZummyScripts)

5fb3df52655d135d9e30714a9fc87714.png.97671db4e559409552d9cee4d3c8b63a.png

Delete the automatically created module

0801484275ac0c114a489ade59bb6af7.png.892415703ec24ce5f338733f813dac84.png

When you want to create a new script, go to File -> New -> Module..

Set the Module name to your script name, make sure the content root and file location is correct

c80d0971c47cdfea0b49de931c28174b.png.1670157ade8c4fefd29626961d164787.png

 

229ac23b5183f2a90f56e37054e1091b.png.c951a5c24230b513acd04e89692caf6f.png

Repeat the process whenever you want to add a new script

a2919ad2d862107635e5376fc2172dab.png.9779a2c32586ddbd4b78cf86bc7366b1.png

Now when you go to create an artifact, you will see each module in the available elements section. Just select which one you want for this .jar

9757881a9a96fa5d9eb415831f156a93.thumb.png.8ceb5bdbb387a4e02fb38351ec47a816.png

 

 

 

Na bro do what I did when I was learning and release all your private scripts in one jar :D

  • Boge 1
Posted
40 minutes ago, Explv said:

Now when you go to create an artifact, you will see each module in the available elements section. Just select which one you want for this .jar

Thanks! Absolute legend! Just one more question ? I have a package containing my custom api, how can I set it up so all modules use that same package?

Posted (edited)
28 minutes ago, Zummy said:

Thanks! Absolute legend! Just one more question ? I have a package containing my custom api, how can I set it up so all modules use that same package?


For the module that you want to use the api in (assuming the api is a module), open up the settings, navigate to Modules, and select dependencies

Click the green + and select Module dependency...

e136f31aa7976a61c13103f008f7c618.thumb.png.eb42e98601c8cdbb3964c74b5cc7c197.png

 

Select your API module, and tick the Export box, select Apply

803c6f8b5ebe2edd7f22bc38299ebfbf.thumb.png.5e66fad800c5ba7705afac110d5160bf.png

 

Now when creating an artifact, instead of selecting JAR -> Empty, select JAR -> From modules with dependencies...

2014f1200aaac6df3c001c9c81f6911f.thumb.png.955f43caf1ced9da5251fd34a9537c38.png

Select your script module, and make sure the extract to the target JAR option is selected

a2f75132e347ec93d8157bbc7afda75c.thumb.png.24d0ab0442c110d9c5cd79ea2ad35e91.png

 

Now your API should be linked, and output into your .jar

850bf50fd3d2bacd53e563077df608bc.thumb.png.8a98a454aede83e997d07bd68739e956.png

Edited by Explv
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...