简体   繁体   English

使用Allatori混淆时,Maven构建失败

[英]maven build fails when using allatori obfuscation

I have enabled obfuscation using antrun-plugin maven plugin. 我已经使用antrun-plugin Maven插件启用了混淆功能。 there is no keep-names in my allatori-config.xml file: 我的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>

This is how my maven plugin configuration looks: 这是我的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>

I have 2 modules(say A and B) for which I want to perform the obfuscation. 我有2个模块(例如A和B),我要对其进行混淆处理。 Now module A get obfuscated successfully but the module B(which is dependent on module A) fails to get compiled saying "cannot find symbol" or "package com.mycomp.xyz.schema does not exist"(where these packages belongs to module A). 现在,模块A的混淆成功,但是模块B(取决于模块A)无法编译,提示“找不到符号”或“包com.mycomp.xyz.schema不存在”(这些包属于模块A) )。

Is it so that if a later used module get obfuscated first, then the dependent modules fails to get the dependencies or there is anything which I am missing? 是这样的,如果以后使用的模块首先被混淆,那么从属模块将无法获得从属关系,或者我缺少任何东西?

So as it says that it fails to find the package and that is very obvious reason. 如此看来,它找不到包,这是非常明显的原因。 the package along with its contents are obfuscated already. 包装及其内容已被混淆。 The solution was to put those of the referred objects in the <keep-names> So that they don't get obfuscated. 解决方案是将引用对象的对象放在<keep-names> ,以免混淆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM