1

I am trying to get this very small project working in intellij(it already works in eclipse). https://github.com/deanhiller/webpiecesExample which is generated from the webpieces webserver project. When booting the server, it can't find the html files in src/main/java(ie. the html files are there rather than src/main/resources to keep locality with their controllers).

I tried adding java:.html and java:.tag as I thought that would work according to this document

https://www.jetbrains.com/help/idea/2016.2/compiler.html

but that doesn't seem to work. I then also found cmd-; opens a window with resources and you can click on directories to mark them as resource directories. I tried doing that but it won't let me do that on a source directory.

Both gradle and eclipse are all working with this project, but I can't seem to get intellij working. It would be very nice to be able to use intellij on this project.

EDIT: Why put some resources in src/main/java instead of src/main/resources...

It can be very annoying to have to create the same package heirarchy in two directories(and slower as you are doing double the work). Also, you miss the view of controller's relationships to html files. Lastly, some files are referenced like ../example/index.html from the controller and literally it makes more sense to the user then if they are in the same tree. If you did ../../../../src/main/resource/com/buffalo/example/index.html, it actually would not even work as it is a relative classpath reference. After working in both environments, we found the one to be more efficient so even though it flies in the face of best practices, it makes developers faster(so best practices vs. developer speed.....I choose speed personally). BUT NOTE: This is not true on all projects. Most project should stick to src/main/java and src/main/resources.

thanks, Dean

Dean Hiller
  • 19,235
  • 25
  • 129
  • 212
  • I just put my resources alongside my classes under src. I have never bothered with a separate resources folder. – john01dav Sep 05 '16 at 01:40
  • usually I agree, but in this case, it gets quite annoying flipping between the two all the time and it would be nice to have it like eclipse where the html view is right next to the controller and flipping between them is easy. I still put logback.xml and appMeta.txt and other one off files in src/main/resources. – Dean Hiller Sep 08 '16 at 00:38
  • oh, I misread you @john01dav yeah, I may start doing the same and just put resources in src/main/java instead of src/main/resources so intellij works again. at least eclipse works for the time being. – Dean Hiller Sep 08 '16 at 15:31
  • I should note that I use Idea's native projects rather than maven, etc. – john01dav Sep 08 '16 at 20:34

0 Answers0