Exclude files from jar intellij
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.
21 Replies
⌛
This post has been reserved for your question.
Hey @blockgoblin31! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose 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.
💤
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.
Bump
huh just mark test directory as test sources
right click on java folder under test dir > mark directory as test sources root
I did but intellij still won’t build a jar because those files won’t compile properly
can you show screenshot of project structure
its color coded
actually I'm having another weird problem so I'm going to try invalidating caches
your directory structures weird, I wonder thats what causing the issue
well that fixed the other problem
weird in what way?
this is what standard java project looks like now a day
show your artifacts tab
have you tried https://i.stack.imgur.com/ayE3J.png
I have, that works fine
so whats the problem now 😅
I was asking if there was a way to do that automatically instead of manually
and putting those in test does not work?
no, it wont build a jar because of an error in a class in tests
what error is that
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.
💤
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.