13

I would like to change the name src/java to src/Javasource because of some CVS concerns Is that possible ?

4 Answers 4

19

Here is a sample build section of a POM that can be used to configure the directories.

<build>
    <directory>target</directory>
    <outputDirectory>target/classes</outputDirectory>
    <finalName>${artifactId}-${version}</finalName>
    <testOutputDirectory>target/test-classes</testOutputDirectory>
    <sourceDirectory>src/main/java</sourceDirectory>
    <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
    <testSourceDirectory>src/test/java</testSourceDirectory>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>
</build>
5

You can set the sourceDirectory in the build tag of your POM

  <build>
    <sourceDirectory>src/Javasource</sourceDirectory>
    ...
  </build>

Take a look at Maven - Introduction to the POM.

3

Yes you can do it; see other answers.

However, folk wisdom is that it is a bad idea to use non-standard organizations for a Maven project, because (so the story goes) it tends to break Maven plugins (and other tools) that assume the standard organization. (At the very least, tooling is likely to be less thoroughly tested for non-standard organizations.)

Another issue is that people expect the standard project organization. Indeed, "strong encouragement" of a standard project organization is (IMO) one of Maven's big selling points.


Can I make a radical suggestion?

Rather than using a non-standard layout for your project because of CVS's limitations, migrate your source code to a newer version control system in which version history is preserved across file and directory renames.

This wikipedia page is a good place to start when looking for alternatives.

1

Yes, it is possible but then you have to define sourceDirectory in pom.xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.