0

I have a mavenized java project in Intellij 122.327. Unfortunately (due to legacy code) certain code in the src directory uses tests in the test directory. I'm trying to remove these dependencies but its a long shot. In the meanwhile, I'm able to compile and deploy by using the build-helper maven plugin and adding src/test/java as sources:

       <execution>
                <id>add-test-dir-source</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>add-source</goal>
                </goals>
                <configuration>
                    <sources>
                        <source>src/test/java</source>
                    </sources>
                </configuration>
            </execution>

Problem is whenever I restart Intellij it keeps marking the src/test directory as a "test" directory (if I go to Project Structure -> Modules -> Sources, src/test is marked in green). So every time I have to manually mark test/java as "Sources". Is there a way to permanently mark this as sources? Even better, does Intellij have a way to read from the pom and infer the project structure?

fo_x86
  • 2,583
  • 1
  • 30
  • 41
  • The directories structures for tests and tested classes must fit. Here is how to do it easily: stackoverflow.com/a/36057080/715269 – Gangnus Mar 17 '16 at 10:23

1 Answers1

-3

Check the logs for any related exceptions. There can be many reasons for this problem like a proxy with the self signed certificate, invalid VM options, network issues, etc. See also this answer.

If the issue persists, contact support with the logs attached.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • Ah, I'd gone through that page before but missed the point! Thank you! One more question, when running the maven "package" build I need to use the "build-helper" plug-in to have my test directory included as source. Does maven not allow an entire directory to be included as source in a build? – fo_x86 Sep 12 '12 at 13:17
  • Update: I figured out that the resource tag simply adds the files (so uncompiled java files are simply added to my jar) and hence the need for the plugin. Seems it isn't possible to include multiple src directories by default in maven. What is weird about IntelliJ is that it only checks the directory tag under resources but doesn't actually check the include, exclude tag. So my work around was to add the test directory as resource but exclude all files. This way when I package my project up, I don't get any raw java files in my jar. Thanks again for the link! – fo_x86 Sep 12 '12 at 13:35