#Exclude files from jar intellij

29 messages · Page 1 of 1 (latest)

austere rover
#

I'm working on something that adds on to a project that I can't run easily for testing, so I have some test files that emulate it through command prompt(roughly), and I was wondering how I could exclude those files from the final jar. They're already in a test directory. The main problem is they wont compile when I'm making a build, because I need to change the type from my test class to the actual production class which breaks things in the test class.

warped umbraBOT
#

This post has been reserved for your question.

Hey @austere rover! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

warped umbraBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

austere rover
#

Bump

stiff siren
#

huh just mark test directory as test sources

#

right click on java folder under test dir > mark directory as test sources root

austere rover
#

I did but intellij still won’t build a jar because those files won’t compile properly

stiff siren
#

can you show screenshot of project structure

#

its color coded

austere rover
#

actually I'm having another weird problem so I'm going to try invalidating caches

stiff siren
#

your directory structures weird, I wonder thats what causing the issue

austere rover
#

well that fixed the other problem

#

weird in what way?

stiff siren
#

this is what standard java project looks like now a day

#

show your artifacts tab

austere rover
stiff siren
austere rover
#

I have, that works fine

stiff siren
#

so whats the problem now 😅

austere rover
#

I was asking if there was a way to do that automatically instead of manually

stiff siren
#

and putting those in test does not work?

austere rover
#

no, it wont build a jar because of an error in a class in tests

stiff siren
#

what error is that

austere rover
#

Ive slowly come to realize that I've been using the test branch wrong and intellij just sorta wasn't complaining for some reason, its completely my fault for not using it properly

#

the best option is just doing it manually

#

my original problem was I had some code that was an addon to something I couldn't run on my computer, so I had seperate code for it to run on top of while testing, basically just redirecting stuff to command prompt instead of to the server. But I didn't want that included in the jar and wanted an automatic way to do that.