2015-02-07 350 views
3

我有一个pom.xml文件给出如下。当我运行mvn clean install,我得到的错误如何使ProGuard Maven插件使用最新的ProGuard版本?

[proguard] Error: Can't read [C:\Program Files\Java\jdk1.8.0_20\jre\lib\rt.jar] 
(Can't process class [com/oracle/net/Sdp$1.class] (Unsupported class version number 
[52.0] (maximum 51.0, Java 1.7))) 

我试图升级ProGuard的版本,并在pom.xml文件设置为5.2

但是当我运行mvn clean install,我得到在控制台以下消息:

[INFO] proguard jar: C:\Users\DP118M\.m2\repository\net\sf\proguard\proguard-base\4.11\proguard-base-4.11.jar 
[proguard] ProGuard, version 4.11 

如何让Maven的ProGuard的插件使用ProGuard的5.2版本,而不是4.11?

下面是完整的pom.xml:

<?xml version="1.0" encoding="UTF-8"?> 

<project xmlns="http://maven.apache.org/POM/4.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>ru.mycompany</groupId> 
    <artifactId>myproduct</artifactId> 
    <version>1.0.10-SNAPSHOT</version> 
    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <powermock.version>1.5.1</powermock.version> 
     <maven.compiler.source>1.7</maven.compiler.source> 
     <maven.compiler.target>1.7</maven.compiler.target> 
    </properties> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>com.github.wvengen</groupId> 
       <artifactId>proguard-maven-plugin</artifactId> 
       <version>2.0.7</version> 
       <executions> 
        <execution> 
         <phase>package</phase> 
         <goals><goal>proguard</goal></goals> 
        </execution> 
       </executions> 
       <configuration> 
        <proguardVersion>5.2</proguardVersion> 
        <options> 
         <option>-allowaccessmodification</option> 
         <option>-dontshrink</option> 
         <option>-dontoptimize</option> 
         <option>-dontnote</option> 
         <option>-keepattributes Signature</option> 
         <option>-keep class ru.mycompany.prd.myproduct.myproductApp { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.gui.IGlassPaneObjectsDisplay { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.misc.IPersistenceForSimulationAuthors { *; }</option> 
         <option>-keep interface com.roots.map.overlay.ILatLongToScreenCoordinatesConverter { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.gui.IMenuBarFactory { *; }</option> 
         <option>-keepclassmembers enum ru.mycompany.prd.myproduct.api.osm.BuildingType { 
         public static **[] values(); 
         public static ** valueOf(java.lang.String); 
         }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.gui.IControlPanelBuilder { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.demography.IPerson { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.osm.IBuilding { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.osm.IWay { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.misc.ISimulationInfo { *; }</option> 
         <option>-keep class ru.mycompany.prd.myproduct.ApplicationStateForSimulationAuthors { *; }</option> 
         <option>-keep enum ru.mycompany.prd.myproduct.impl.gui.ApplicationStateSingleton { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.gui.IApplicationState { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.gui.IEventBus { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.gui.IMouseEventListener { *; }</option> 
         <option>-keep class ru.mycompany.prd.myproduct.impl.osm.Building { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.gui.IPolygon { *; }</option> 
         <option>-keep interface 
          ru.mycompany.prd.myproduct.api.gui.IGlassPaneRepainter { *; }</option> 
         <option>-keep class ru.mycompany.prd.myproduct.impl.gui.GuiUtils { *; }</option> 
         <option>-keep class ru.mycompany.prd.myproduct.impl.osm.Road { *; }</option> 
         <option>-keep class ru.mycompany.prd.myproduct.impl.osm.PolyLine { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.api.osm.IRoad { *; 
          }</option> 
         <option>-keep interface 
          ru.mycompany.prd.myproduct.api.gui.IStandardVisualElementPainter { *; }</option> 
         <option>-keep class ru.mycompany.prd.myproduct.actions.ApartmentBuildingAction { *; }</option> 
         <option>-keep class ru.mycompany.prd.myproduct.actions.RoadAction { *; }</option> 
         <option>-keep class ru.mycompany.prd.myproduct.actionsgui.ActionsDialog { *; }</option> 
         <option>-keep class ru.mycompany.prd.myproduct.actionsgui.ActionsTableModel { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.models.IPeopleBehaviourModel { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.actions.IAction { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.actionsgui.IActionCollection { *; }</option> 
         <option>-keep interface 
          ru.mycompany.prd.myproduct.impl.controller.IPersistenceInitializedListener { *; }</option> 
         <option>-keep class ru.mycompany.prd.myproduct.kpi.AbstractSensor { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.kpi.ISensor { *; }</option> 
         <option>-keep interface ru.mycompany.prd.myproduct.kpi.ISensorDataDisplay { *; }</option> 
         <option>-keep enum ru.mycompany.prd.myproduct.api.demography.Gender { *; }</option> 
        </options> 
        <libs> 
         <lib>${java.home}/lib/rt.jar</lib> 
        </libs> 
        <dependencies> 
         <dependency> 
          <groupId>net.sf.proguard</groupId> 
          <artifactId>proguard-base</artifactId> 
          <version>5.2</version> 
          <scope>runtime</scope> 
         </dependency> 
        </dependencies> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <dependencies> 

     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.10</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.easytesting</groupId> 
      <artifactId>fest-util</artifactId> 
      <version>1.2.3</version> 
     </dependency> 
     <dependency> 
      <groupId>org.powermock</groupId> 
      <artifactId>powermock-api-support</artifactId> 
      <version>1.5.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.powermock</groupId> 
      <artifactId>powermock-reflect</artifactId> 
      <version>1.5.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.powermock</groupId> 
      <artifactId>powermock-core</artifactId> 
      <version>1.5.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.easytesting</groupId> 
      <artifactId>fest-assert-core</artifactId> 
      <version>2.0M8</version> 
     </dependency> 
     <dependency> 
      <groupId>com.google.guava</groupId> 
      <artifactId>guava</artifactId> 
      <version>15.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.mockito</groupId> 
      <artifactId>mockito-all</artifactId> 
      <version>1.9.5</version> 
     </dependency> 
     <dependency> 
      <groupId>com.h2database</groupId> 
      <artifactId>h2</artifactId> 
      <version>1.3.173</version> 
     </dependency> 
     <dependency> 
      <groupId>ru.mycompany</groupId> 
      <artifactId>commons</artifactId> 
      <version>2.9</version> 
     </dependency> 
     <dependency> 
      <groupId>org.powermock</groupId> 
      <artifactId>powermock-module-junit4</artifactId> 
      <version>${powermock.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.powermock</groupId> 
      <artifactId>powermock-api-mockito</artifactId> 
      <version>${powermock.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.easymock</groupId> 
      <artifactId>easymock</artifactId> 
      <version>3.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.powermock</groupId> 
      <artifactId>powermock-api-easymock</artifactId> 
      <version>${powermock.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>ch.qos.logback</groupId> 
      <artifactId>logback-core</artifactId> 
      <version>0.9.26</version> 
     </dependency> 
     <dependency> 
      <groupId>ch.qos.logback</groupId> 
      <artifactId>logback-classic</artifactId> 
      <version>0.9.26</version> 
     </dependency> 
     <dependency> 
      <groupId>net.sf.opencsv</groupId> 
      <artifactId>opencsv</artifactId> 
      <version>2.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.jgrapht</groupId> 
      <artifactId>jgrapht-jdk1.5</artifactId> 
      <version>0.7.3</version> 
     </dependency> 
     <dependency> 
      <groupId>jgraph</groupId> 
      <artifactId>jgraph</artifactId> 
      <version>5.13.0.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.googlecode.soundlibs</groupId> 
      <artifactId>jlayer</artifactId> 
      <version>1.0.1-1</version> 
     </dependency> 
     <dependency> 
      <groupId>com.javadocmd</groupId> 
      <artifactId>simplelatlng</artifactId> 
      <version>1.3.0</version> 
     </dependency> 
     <!-- Overpass stuff (start) --> 
     <dependency> 
      <groupId>se.kodapan.osm.common</groupId> 
      <artifactId>core</artifactId> 
      <version>0.0.2-SNAPSHOT</version> 
     </dependency> 
     <dependency> 
      <groupId>se.kodapan.osm.common</groupId> 
      <artifactId>java</artifactId> 
      <version>0.0.2-SNAPSHOT</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.httpcomponents</groupId> 
      <artifactId>httpclient</artifactId> 
      <version>4.1.2</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-io</groupId> 
      <artifactId>commons-io</artifactId> 
      <version>2.3</version> 
     </dependency> 
     <!-- Overpass stuff (end) --> 
     <dependency> 
      <groupId>org.javatuples</groupId> 
      <artifactId>javatuples</artifactId> 
      <version>1.2</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.vividsolutions</groupId> 
      <artifactId>jts</artifactId> 
      <version>1.12</version> 
     </dependency> 
    </dependencies> 
</project> 

回答

3

我通过改变proguard-maven-plugin2.0.7的版本2.0.8解决了这一问题。