0

I have jar file having some properties files in it like log4j.properties and config.properties. Following is my ant script for yguard. Everything else is working but the properties file updation.

<target name="yguard">
    <taskdef name="yguard" classname="com.yworks.yguard.YGuardTask" classpath="lib/yguard.jar" />
    <yguard>
        <inoutpairs resources="none">
            <fileset dir="${basedir}">
                <include name="MyApp.jar" />
            </fileset>
            <mapper type="glob" from="MyApp.jar" to="MyAppObs.jar" />
        </inoutpairs>
        <externalclasses>
            <pathelement location="lib/log4j-1.2.17.jar" />
        </externalclasses>
        <rename conservemanifest="true" mainclass="com.amit.Application" >
            <adjust replaceContent="true" >
                <include name="**/*.properties" />
            </adjust>
        </rename>
    </yguard>
</target>

config.properties file

com.amit.Application.param1 = something

I found some question in stackoverflow but they didn't help. One place it was mentioned that the file (like jsp, xml, properties) should be in the jar file which I already have. But my yguard obfuscated file just get the files copied as it is.

I tried many combinations with rename & adjust tags but nothing worked for me.

Following post I already visited

Is it possible to manage logs through Obfuscation with yGuard?

How to include obfuscated jar file into a war file

Community
  • 1
  • 1
Amit
  • 281
  • 1
  • 6
  • 16

1 Answers1

0

Apparently you want yGuard to obfuscate the name of the field param1, because com.amit.Application is obviously your entry point and yGuard excludes the given main class automatically. So basically you want the outcome to be something like

com.amit.Application.AÖÜF = something

This isn't possible, because yGuard can only adjust class names in property files, as state here: yGuard Manual

zhujik
  • 6,514
  • 2
  • 36
  • 43
  • Thanks Sabastian for the comments but I want yguard to replace the class name not the param name. The class name I mentioned was just a sample unfortunately I picked something resembling entry class but its just some class other than main class. – Amit Jan 24 '14 at 19:11
  • then write it like this: com.amit.Application#param1 = something – zhujik Jan 25 '14 at 00:28
  • I am not sure how this will help. Even if I just put the class name in that file it doesn't get replaced with obfuscated name. Any other suggestion? – Amit Jan 25 '14 at 10:20
  • No, because it works for me. I placed a properties file into my project, a class that gets obfuscated, then wrote something like com.MyClass#value = "hi" into the properties file, adjusted the build process like you did and it works. – zhujik Jan 25 '14 at 17:45