0

I just created a sample Java program.

My source tree looks like below

[sathish@oc3855733574 java_tools]$ tree
.
├── pom.xml
├── src1
│   └── FirstProg.java

I have created a simple pom.xml file as shown below

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>src1</groupId>
    <artifactId>first-prog</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <build>
        <resources>
            <resource>
                <directory>src1</directory>
            </resource>
        </resources>
    </build> 
</project>

When I try to do mvn package, maven throws the error message as follows.

I understand it looks out for src/main/resources but can't I compile using 'my own' directory structure?

INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ first-prog ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ first-prog ---
[INFO] No sources to compile
Mifeet
  • 12,949
  • 5
  • 60
  • 108
Sathish Kumar
  • 2,150
  • 10
  • 29
  • 51
  • Possible duplicate of [Handling unconventional source directory for a web project in maven](http://stackoverflow.com/questions/224373/handling-unconventional-source-directory-for-a-web-project-in-maven) – Mifeet May 15 '16 at 08:03
  • What is the purpose of changing the default folder structure? Do you have good reasons to do ? – khmarbaise May 15 '16 at 09:31
  • @khmarbaise I just started learning maven. But, the primary reason is our company has decided to move away from 'ant' to 'maven' where we have different folder structure – Sathish Kumar May 15 '16 at 14:07
  • @Mifeet Can I have multiple tags? Please let me know whether that's possible – Sathish Kumar May 15 '16 at 14:09

1 Answers1

2

Don't do this.

The whole point of Maven is convention over configuration and in this case the convention is to use the generators and then customise.

Lee
  • 738
  • 3
  • 13