David
David

Reputation: 1

Maven is making unwanted changes to the Eclipse .classpath

I recently added some new items to my pom.xml. For some reason, after adding these new items, and I run a Maven project update, it modifies the Eclipses .classpath.

Here are the pom.xml items that were added:

 <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>jcl-over-slf4j</artifactId>
    <version>${org.slf4j-version}</version>
    <scope>runtime</scope>
</dependency>
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>${log4j-version}</version>
    <scope>runtime</scope>
</dependency>
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-slf4j-impl</artifactId>
    <version>${log4j-version}</version>
</dependency>
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>${log4j-version}</version>
    <exclusions>
        <exclusion>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
        </exclusion>
        <exclusion>
            <groupId>javax.jms</groupId>
            <artifactId>jms</artifactId>
        </exclusion>
        <exclusion>
            <groupId>com.sun.jdmk</groupId>
            <artifactId>jmxtools</artifactId>
        </exclusion>
        <exclusion>
            <groupId>com.sun.jmx</groupId>
            <artifactId>jmxri</artifactId>
        </exclusion>
    </exclusions>
    <scope>runtime</scope>
</dependency>

In the .classpath after Maven does a project update, it adds: including="**/*.java"

<classpath>
    <classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>

...

</classpath>

Because of this, when I run the java, none of my resources are being found because they're not .java. I'm not sure why those new items that were added to Maven, are making it suddenly modify the Eclipse .classpath. I tried manually removing the including="**/*.java", but once Maven does another project update, it puts it back.

Does anyone have an idea why this is occurring? I appreciate the help, thanks.

Upvotes: 0

Views: 594

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35853

If you use Maven in Eclipse, then the m2e plugin controls the .classpath file.

You need to manage your resources through the POM, not through .classpath.

Upvotes: 1

Related Questions