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
JavaBot
JavaBot10mo ago
This post has been reserved for your question.
Hey @blockgoblin31! 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. 💤 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.
blockgoblin31
blockgoblin31OP10mo ago
Bump
straightface
straightface10mo ago
huh just mark test directory as test sources right click on java folder under test dir > mark directory as test sources root
blockgoblin31
blockgoblin31OP10mo ago
I did but intellij still won’t build a jar because those files won’t compile properly
straightface
straightface10mo ago
can you show screenshot of project structure its color coded
blockgoblin31
blockgoblin31OP10mo ago
No description
blockgoblin31
blockgoblin31OP10mo ago
actually I'm having another weird problem so I'm going to try invalidating caches
straightface
straightface10mo ago
your directory structures weird, I wonder thats what causing the issue
blockgoblin31
blockgoblin31OP10mo ago
well that fixed the other problem weird in what way?
straightface
straightface10mo ago
No description
straightface
straightface10mo ago
this is what standard java project looks like now a day show your artifacts tab
blockgoblin31
blockgoblin31OP10mo ago
No description
blockgoblin31
blockgoblin31OP10mo ago
I have, that works fine
straightface
straightface10mo ago
so whats the problem now 😅
blockgoblin31
blockgoblin31OP10mo ago
I was asking if there was a way to do that automatically instead of manually
straightface
straightface10mo ago
and putting those in test does not work?
blockgoblin31
blockgoblin31OP10mo ago
no, it wont build a jar because of an error in a class in tests
straightface
straightface10mo ago
what error is that
blockgoblin31
blockgoblin31OP10mo ago
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.
JavaBot
JavaBot10mo ago
💤 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.
Want results from more Discord servers?
Add your server