proguard-spring-boot-example icon indicating copy to clipboard operation
proguard-spring-boot-example copied to clipboard

spring.boot.jar has not been obfuscated

Open CodeSmolder opened this issue 1 year ago • 3 comments

If I run mvn package, everything looks fine.

The file target/spring.boot.jar is running properly.

But if I unzip the file target/spring.boot.jar and pick a class file, which should have been obfuscated, the decompiler shows me:

package com.slm.proguard.example.spring.boot.service;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.slm.proguard.example.spring.boot.dto.ExampleDto;
import com.slm.proguard.example.spring.boot.dto.ExampleObjectMapperDto;
import java.util.HashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class ExampleService {
   private static final Logger LOGGER = LoggerFactory.getLogger(ExampleService.class);
   private final ObjectMapper objectMapper;
   private final ExampleDto exampleDto = ExampleDto.builder().variableInt(20).variableString("Test String").variableObject(new HashMap()).build();

   public int calculate() {
      return this.exampleDto.getVariableInt() * 10;
   }

   public String serializeObjectToString() throws Exception {
      ExampleObjectMapperDto exampleObjectMapper = (new ExampleObjectMapperDto()).setVariableInt(20).setVariableString("Test String").setVariableObject(new HashMap());
      return this.objectMapper.writeValueAsString(exampleObjectMapper);
   }

   public ExampleService(final ObjectMapper objectMapper) {
      this.objectMapper = objectMapper;
   }
}

Running the file target/spring.boot-obfuscated.jar will not work either and show the error mention in #4.

What am I doing wrong?

CodeSmolder avatar Feb 08 '24 20:02 CodeSmolder

I'll check it tomorrow, give me please some time

devslm avatar Feb 08 '24 20:02 devslm

@devslm You are running the Pre Obfuscate jar, But the post obfuscated jar is not working with java -jar command

rawatvinod4164 avatar Feb 22 '24 08:02 rawatvinod4164