【问题标题】:maven build fails when using allatori obfuscation使用 allatori 混淆时,maven 构建失败
【发布时间】:2017-11-30 08:57:44
【问题描述】:

我已经使用 antrun-plugin maven 插件启用了混淆。我的allatori-config.xml 文件中没有keep-names

<config>
 <keep-names>
 </keep-names>
  <jars>
    <jar in="${obf.jar}" out="${obf.jar}"/>
  </jars>
  <property name="log-file" value="target/allatori-log.xml"/>
</config>

这是我的 maven 插件配置的样子:

   <plugin>
         <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
           <version>1.6</version>
           <executions>
             <execution>
              <phase>package</phase>
               <id>obfuscate2</id>
                <configuration>
                 <target unless="${obfuscation.skip}">
                   <echo message="running allatori"/>
                   <property name="obf.jar" value="target/XYZ-${project.version}.jar"/>
                   <property name="runtime_classpath" refid="maven.runtime.classpath"/>
                   <taskdef name="allatori" classname="com.allatori.ant.ObfuscatorTask" classpath="${env.ALLATORI_LIB}/allatori.jar:${runtime_classpath}"/>
                   <allatori config="${basedir}/allatori-config.xml"/>
                 </target>
               </configuration>
               <goals>
                 <goal>run</goal>
               </goals>
             </execution>
          </executions>
       </plugin>

我有 2 个模块(比如 A 和 B)要对其执行混淆处理。 现在模块 A 已成功混淆,但模块 B(依赖于模块 A)无法编译并显示“找不到符号”或“包 com.mycomp.xyz.schema 不存在”(这些包属于模块 A )。

如果稍后使用的模块首先被混淆,那么依赖模块无法获取依赖项或者我缺少什么?

【问题讨论】:

    标签: maven obfuscation allatori


    【解决方案1】:

    所以正如它所说,它无法找到包裹,这是非常明显的原因。包裹及其内容已经被混淆了。 解决方案是将那些被引用的对象放在&lt;keep-names&gt; 中,这样它们就不会被混淆。

    【讨论】:

      猜你喜欢
      • 2021-05-22
      • 2012-08-18
      • 2016-04-14
      • 2010-11-26
      • 1970-01-01
      • 2014-08-17
      • 1970-01-01
      • 1970-01-01
      • 2014-12-31
      相关资源
      最近更新 更多