I am trying to run some vulnerability scans(Veracode) on a spring boot application. However, the scan provider suggests running the scans with binaries compiled in debug mode using the following in pom.xml
file.
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>
</configuration>
</plugin>
</plugins>
</build>
However, we use the same pom.xml
for production deployment where we don't want debug level jars.
Is there a way to create debug jars by passing some argument to the mvn
command?
CodePudding user response:
I think it is possible to set the arguments in the command line with -D
like this:
mvn compile -Dmaven.compiler.debug=true -Dmaven.compiler.debuglevel=lines,vars,source
CodePudding user response:
You can use profiles.
<profiles>
<profile>
<id>debug</id>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profile>
Profiles are activated in the mvn
command, e.g., mvn ... -Pdebug
.