Maven Java EE Configuration

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

In my maven project, I have this Effective POM:




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

    Also as Kefas I am specify java version to 1.7 and it works!

     <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
             <source>1.7</source> 
             <target>1.7</target> 
        </configuration>
    </plugin>
    
    0 讨论(0)
  • 2020-12-08 11:46

    GGrec's solution doesn't work for me. I manage to fixed this issue by adding to pom.xml this:

    <build>
         <finalName>finalName</finalName>
         <plugins>
    
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source> <!-- yours Java version -->
                    <target>1.8</target> <!-- yours Java version -->
                </configuration>
            </plugin>
    
        </plugins>
    </build>
    

    UPDATE: In addition I figured out that everytime you run mvn install command on this pom.xml it overrides previous configuration. The right solution is either remove this version from pom.xml and set it up in eclipse options or just use configuration from pom.xml.

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

    This might sound silly but I just did Project->Clean and then Maven->Update.

    Solved the problem.

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

    I have added below line of code in pom.xml and it worked.

    <properties>
            <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
    </properties>
    
    0 讨论(0)
  • 2020-12-08 11:47

    The above suggests is helpful for me! Right click on project -> Properties -> Project Facets, then change the Java facets version to 1.7.

    If it doesn't work, add the following code to pom.xml:

    <build>
        <finalName>finalName</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source> <!-- yours Java version -->
                    <target>1.7</target> <!-- yours Java version -->
                </configuration>
            </plugin>
        </plugins>
    </build>
    

    Save pom.xml.

    And then, right click on project-->Maven-->Update Project.

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

    The Right Answer is : - Just a Simple thing Most of times you cant change the Dynamic Web Module Version to 3.0 .. it must be default set to 2.3 or 2.4 or else. Its not gonna work right click on project-> preference -> project facet -> uncheck dynamic web module and change the version to 3.0 then check it. and i think you have to change the latest version for ( i.e: 1.7 or higher ) that . after that click apply and close button.

    then update the maven project.. right click on project select maven -> update project. still the error will continue for 80% of us..

    The Real Solution is here 1> go to you work space folder 2> then go to your project folder 3> check for .settings file (sometimes it may be hidden then unhide it..(so rare chance ) 4> Go into that .settings file then check for org.eclipse.wst.common.project.facet.core.xml file and edit with notepad++ or some thing like that..enter code here 5>this is the code inside that

    <?xml version="1.0" encoding="UTF-8"?>
    <faceted-project>
      <fixed facet="wst.jsdt.web"/>
      <installed facet="java" version="1.5"/>
      <installed facet="jst.web" version="2.4"/>
      <installed facet="wst.jsdt.web" version="1.0"/>
    </faceted-project>
    

    change the jst.web version to 3.0 like this

    <?xml version="1.0" encoding="UTF-8"?>
    <faceted-project>
      <fixed facet="wst.jsdt.web"/>
      <installed facet="java" version="1.5"/>
      <installed facet="jst.web" version="3.0"/>
      <installed facet="wst.jsdt.web" version="1.0"/>
    </faceted-project>
    

    then finally update the maven .. then restart the eclipse or another IDE

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