I have converted an existing Java project to a Maven project and Maven builds everything perfectly when using the command line.
When I import the same project into Eclipse and compile (by right-clicking the project -> runs as Maven build, it still compiles without any issue.
However, I am not able to see the source folder. When I check the build path it gives warning - build path entry is missing.
I am not using standard src/main/java
since I had a pre-existing folder structure for the project which could not be changed.
Here's my pom (notice the sourceDirectory
tag):
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>com.mycom</groupId>
<artifactId>maven</artifactId>
<version>17.4</version>
<name>maven</name>
<properties>
<projecrt.rootDir>../../java</projecrt.rootDir>
</properties>
<build>
<finalName>re</finalName>
<sourceDirectory>${projecrt.rootDir}</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifestEntries>
<Build-Version>${buildversion}</Build-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
and here's my directory structure:
Src/java
----maven/pom.xml
----com/mycom/<...> // application code