How to solve the problem that the src/main/java resource folder cannot be created after Eclipse builds the Maven project

 After creating a Maven project, if there is no src/main/java folder under the Java Resources resource file, and when manually creating this file, it prompts "The file already exists".
This shows that there is already a folder src/main/java in this project configuration. As for why it is not displayed, I don't know yet. I hope someone understands and follows me, thank you. (Solved)
   The first method: Open the classpath file of the project: as follows

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" output="target/test-classes" path="src/test/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" path="src/main/java"/>
    <classpathentry kind="src" path="src/main/resources"/>
    <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
            <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
        <attributes>
            <attribute name="owner.project.facets" value="java"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

  There will be a classpathentry node with the path attribute: src/main/java, then delete the new node we need to create, such as <classpathentry kind="src" path="src/main/java"/>. Re-create the src/main/java folder under Java Resources and there will be no problem.

    Second method: This is the most convenient one. Right-click on the project and select properties, then click java build path, under Librarys, edit the JRE System Library, and select workspace default jre.


The original address is: http://www.ayblogs.com/?post=307

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325740968&siteId=291194637