Maven Java EE Configuration

前端 未结 12 1314
南方客
南方客 2020-12-08 11:30

In my maven project, I have this Effective POM:




        
相关标签:
12条回答
  • 2020-12-08 11:51

    After following above troubleshooting steps. Update your maven project.

    Right click on your project--> Maven--> Update Project

    Or simply Alt+f5.

    Hope this might help someone.

    0 讨论(0)
  • 2020-12-08 11:53
    1. Go to project Build Path and change the Java Library version to 1.7
    2. Go to Eclipse Preferences -> Java -> Compiler -> Change compliance level to 1.7
    3. Right click on project -> Properties -> Project Facets
    4. Uncheck Dynamic Web Module and click Apply (also uncheck JavaServer Faces if you had that)
    5. Change the Java facet version to 1.7 and click Apply
    6. Add the Dyanmic Web Module v3.0, apply.

    Eclipse's facets configuration is buggy. Make sure you keep hitting Apply between checking and unchecking of facets.

    Links:

  • Cannot change version of project facet Dynamic Web Module to 3.0?
  • Change version of project facet Dynamic Web Module to 2.5

0 讨论(0)
  • 2020-12-08 11:56

    This works for me:

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.3</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.6</version>
                    <configuration>
                        <warSourceDirectory>src/main/webapp</warSourceDirectory>
                        <warName>mfp</warName>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <finalName>myprojectname</finalName>
    </build>
    
    0 讨论(0)
  • 2020-12-08 11:57

    I had to reset maven settings in Window->Preferences->Maven-> User Settings to "C:\Development\apache-maven-3.5.3\conf\settings.xml".

    0 讨论(0)
  • 2020-12-08 12:02

    Changed version to 3.1 and the tags and to 1.7

     <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
         <source>1.7</source> 
         <target>1.7</target> 
    </configuration>
    

    0 讨论(0)
  • 2020-12-08 12:04

    I am using java 1.8. Fixed doing the following.

    Remove from pom:

    <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
    

    It will complain that pom is not up to date. Used quick fix to update then you get a whole bunch of errors.

    RE-ADD to pom:

    <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
    

    Updated maven and all errors are cleared.

    0 讨论(0)
  • 提交回复
    热议问题