1

How do I mark packages as excluded (i.e. so IntelliJ doesn't refuse to run or build the project if one of them is broken) whilst still pushing them via git? How does one separate the functionalities of exclusion from git and exclusion from runtime?

Context:

I am basically using IntelliJ to hold emptyworksheet/worksheet/solutions packages in the same project as it doesn't allow multiple projects open at once. It is not intended to be elegant or workable - just to emulate the environment I write Java in whilst keeping the 'solutions' and 'empty worksheets' handy for repeat attempts.

jMan
  • 587
  • 1
  • 8
  • 23
  • 1
    It's not really clear what you're asking but you can definitely open multiple projects in intellij. It's also not obvious what's preventing you from pushing a project that doesn't build. – pvg Oct 15 '17 at 15:59
  • 1
    Well what build tool are you using? I am fairly certain that with something like Maven or Ant you can handpick whichever folders you want in a build. – Tim Biegeleisen Oct 15 '17 at 16:00
  • I am not using a build tool (just created 'Java Application') but I am increasingly getting the impression that not using a build tool is like riding a bike without wheels – jMan Oct 15 '17 at 16:04
  • 1
    An intellij project can also be split into modules which can be built separately. But again, it's not clear what this has to do with git. Please edit your question to add more details. – pvg Oct 15 '17 at 16:09
  • separate modules makes a lot of sense. Git would be my way of accessing this on separate machines - tracking my mistakes - maybe bulking this up later on if I want to make it more complicated or functional instead of just a notepad. – jMan Oct 15 '17 at 16:13
  • in the end I have opted for commenting out bad methods instead of excluding the directories at all – jMan Oct 15 '17 at 18:17
  • @jMan see https://stackoverflow.com/questions/22291986/intellij-exclude-file-from-being-compiled – CrazyCoder Oct 16 '17 at 00:48

1 Answers1

1

I'd suggest using modules. You can unload the modules you do not need from the project, so that the IDE does not compile them (see https://www.jetbrains.com/help/idea/temporarily-ignoring-unused-modules.html for details).
Starting from the last 2017.3 EAP build (https://www.jetbrains.com/idea/nextversion/), IDEA will also check if changes you are about to commit are going to break compilation for unloaded modules, and will warn you about that: https://blog.jetbrains.com/idea/2017/10/intellij-idea-2017-3-eap-brings-improvements-for-unloaded-modules/.

Little My
  • 170
  • 1
  • 2