0

I'm restructuring an existing project to the Maven Standard Structure and don't really know where to put certain items.

For example, I have a directory that contains a group of Java Classes that is used to append a toString() to other Classes. I'm not sure were to put this in respect to the standard structure of maven.

I guess the best way to describe these classes is "extra, but still important stuff". I'm pretty new to Maven and build tooling in general, so any help or guidance is welcome!

**Edit: So I was informed that these classes don't get compiled and are not "real" Java classes. Thinking more about this, I'm inclined to place it under src/main/resources then. Is that agreeable?

Opzoleet
  • 38
  • 1
  • 8

1 Answers1

0

In terms of Maven standard structure, its either /src/main/java or /src/test/java. There is no ambiguity.

Maybe you are asking yourself in which package you should put these classes? This is completly independant from the build tool, for which only the source folders matter.

src/main/resources are for everything which is not compiled but needs to be available from the main classes, so yes it should,go there.

Still wondering what these classes but not really classes are...

Mathieu Fortin
  • 1,048
  • 7
  • 17
  • yeah, that's what I was thinking also. Just wasn't sure if there was another directory things of that nature would need to go under. – Opzoleet Jun 12 '14 at 18:21
  • Bonus tip: with Maven, headaches start appearing when you go past the standard structure, so make sure you follow the conventions. – Mathieu Fortin Jun 12 '14 at 18:27
  • in regards to "classes but not really classes", I'm actually not entirely certain what they are other than each contains a toString() method that, from what I'm lead to believe, are appended to the end of a related class. Why they aren't part of those classes to start, you got me, I didn't develop the project. The hesitation I have of including these even in the resources is when this is made a jar, we don't really care about them, as they would have been appended to the aforementioned classes well before a binary is created via an Ant script (I think). – Opzoleet Jun 12 '14 at 18:38
  • continued... So what I'm asking then, is it possible to exclude these from being bundled with the Jar? I feel like I've seen that it is, so maybe I'm answering my own question there. – Opzoleet Jun 12 '14 at 18:39
  • 1
    Ok think I understand. They are processed before actual compilation of the main classes. You can achieve this by putting these files in a complete separate folder, unknown to maven. I would then reuse the ant script portion which append the method and launch it using the maven-ant-plugin before the compile goal. – Mathieu Fortin Jun 12 '14 at 18:45
  • Thanks Mathieu, you've been extremely helpful! – Opzoleet Jun 12 '14 at 18:58