0

I am converting my existing project into maven but the point at which I am getting stuck is that I don't want to use the standard src/main/java structure.

I thought How to edit the directory structure in Maven? might help, but from what I understood it gives a way to append a directory path before src/main/java. This is the solution suggested in post that I am referring to:

<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
    <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
    <resources>
      <resource>
        <directory>${project.basedir}/src/main/resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>${project.basedir}/src/test/resources</directory>
      </testResource>
    </testResources> 

Whereas, in my case I want to be able to completely configure the source and build/output directories as I can't alter my existing directory structure. Is there a way to do that?

tryingToLearn
  • 10,691
  • 12
  • 80
  • 114
  • 1
    Why do you want to use a structure different from the recommended structure? – Chetan Kinger Mar 01 '18 at 04:06
  • @CKing, because changing the directory structure will pile on a lot of ad-hoc tasks to be done in the ecosystem(CM builds, Version control etc.) There are legacy set of projects out of which there is 1 project in which I want to use maven to leverage dependency management. – tryingToLearn Mar 01 '18 at 04:12
  • 1
    The most important thing is to understand Convention over Configuration which the directory structure is part of. Apart from that: What are the reasons not to use the default folder structure? Just change your existing structure into the default structure and that's it? – khmarbaise Mar 01 '18 at 11:46
  • Really, change the structure, I had a project with just a web root set to a different location and it was a nightmare. Changing the structure is worth it. Just my experience. If you're using Linux you might be able to fake it using symlinks. That way you would have both, backward compatibility and maven build working. – Ondřej Xicht Světlík Mar 02 '18 at 22:40

0 Answers0