0

有一个选项 javac -O 可以根据 Javac 手册编译优化的 java 代码。我可以使用 maven 来使用这个标志吗?

4

2 回答 2

5

Hi you need to configure the maven-compiler-plugin like this:

<project>
  ...
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.1</version>
          <configuration>
            <optimize>true</optimize>
            ...
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  ...
</project>
于 2013-04-29T14:53:54.287 回答
-2

From the documentation, you could do something like this:

<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <compilerArgument>-O</compilerArgument>
        </configuration>
      </plugin>
    </plugins>
    [...]
  </build>
  [...]
</project>
于 2013-04-29T14:53:15.137 回答