I can't get intellij to work with this project at all


(Dean Hiller) #1

I have eclipse working this project https://github.com/deanhiller/webpiecesExample which is a pretty simple hello world type project. I am trying to get intellij working with that project to try it out in intellij.

I have tried the gradle plugin(Intellij 15) and ./gradlew idea(which seems like a complete failure as intellij unlike eclipse seems to force me into the plugin when I try to mount that project…perhaps I should delete all my .gradle files temporarily).

thanks,
Dean


(Dean Hiller) #2

I am upgrading/retrying on intellij 2016 and will update this today with those results.


(Dean Hiller) #3

ok, 2016 Intelli gradle plugin doesn’t work either (and I am not sure how to fix it…I was at least able to work around the issues in eclipse temporarily so I am hoping in intellij there is a way as well)j, I was able to suck the project in and it actually compiles fine this time but had issues later. Here are the steps…

  1. git clone https://github.com/deanhiller/webpiecesExample.git
  2. import into intellij with gradle plugin
  3. run the class webpiecesExample/mycool-dev/src/main/java/com/buffalo/MyCoolDevServer.java
  4. hit http://localhost:8080
  5. RESULT: FileNotFound exception since it can’t find html file on the classpath

The core issue is the html files are in mycool/src/main/java not in src/main/resources so is there a way to make intellij find them as a work around?

thanks,
Dean


(Stefan Oehme) #4

The html files shouldn’t be in src/main/java, that’s for java source code only.

You could reconfigure your project to make that folder both a java source folder and a resource folder, but I strongly suggest you stick with the best practices.


(Dean Hiller) #5

nah, we find it is slower then as you have to double create package heirarchies which is very annoying. Best practices when we find are slower are not very much best practices anymore. For most projects, I would say following that is ok. When the html files are relative referenced from controllers, that can get quite annoying. Gradle was nice and flexible in allowing this…something that we hated about maven and why we switched.


(Stefan Oehme) #6

I also replied in the other topic how to do it:

sourceSets.main.resources.srcDir 'src/main/java'

You’ll also need to add excludes to it so you don’t copy .java files to the jar.

Btw. IntelliJ creates these folder hierarchies for you automatically.