2015-12-21 42 views

回答

5

最好是通過enforcer rule可以通過使用maven-enforcer-plugin被應用到您的構建來檢查字節碼...

<project> 
    [...] 
    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-enforcer-plugin</artifactId> 
     <version>1.4.1</version> 
     <executions> 
      <execution> 
      <id>enforce-bytecode-version</id> 
      <goals> 
       <goal>enforce</goal> 
      </goals> 
      <configuration> 
       <rules> 
       <enforceBytecodeVersion> 
        <maxJdkVersion>1.7</maxJdkVersion> 
       </enforceBytecodeVersion> 
       </rules> 
       <fail>true</fail> 
      </configuration> 
      </execution> 
     </executions> 
     <dependencies> 
      <dependency> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>extra-enforcer-rules</artifactId> 
      <version>1.0-beta-4</version> 
      </dependency> 
     </dependencies> 
     </plugin> 
    </plugins> 
    </build> 
    [...] 
</project> 
相關問題