maven: (use -source 5 or higher to enable static import declarations)

后端 未结 1 1756
失恋的感觉
失恋的感觉 2021-01-01 10:45

How can I use source 5? I tried

mvn -source 5 test

but it didn\'t work :-)

When I compile the file by javac, everything works.

相关标签:
1条回答
  • 2021-01-01 11:19

    You need to configure the maven-compiler-plugin:

    <project>
      ...
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
              <source>1.5</source>
              <target>1.5</target>
            </configuration>
          </plugin>
          ...
        </plugins>
        ...
      </build>
    </project>
    

    EDIT: Changed example to use latest version of the plugin.

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