Open scottkurz opened 4 years ago
I ran into the same issue.
I defined the following in the pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<compilerArgument>-parameters</compilerArgument>
</configuration>
</plugin>
And when using the dev mode, the tests which make use of the constructor arguments names via reflection fail:
Did not find parameter 'arg1' of same type in list of fields: [value]
Problem is, that the name of constructor argument is unknown (arg1 instead of value).
When executing the tests using mvn package
the result is fine.
Hi, is anybody able to debug the server running in dev mode? For me this seems not be possible without the debug information available? Does anybody know a workaround? Thank you very much and many regards, Tobias
Hi @baumato , this is an issue with how dev mode compiles classes, so one workaround would be to force Maven to recompile the classes before you hit breakpoints.
For example, set the following profile in pom.xml
to allow cleaning only the classes (you can also change this to be specific to only the packages that you want to recompile):
<profiles>
<profile>
<id>cleanClasses</id>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>target/classes</directory>
<includes>
<include>**/*.class</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Then run the following in another terminal before hitting your breakpoints:
mvn clean -P cleanClasses compile
@ericglau running mvn clean is going to delete everything target including the Liberty server running dev mode. Did you mean to suggest that?
This seems like a workaround and dev mode should support the debug data OOTB.
@NottyCode The above workaround provides a custom profile for mvn clean
that will only delete class files (or specific class files if needed). Yes, it is a temporary workaround and dev mode should be fixed to support it.
@scottkurz I believe the compiler options are now honored in dev mode with the various PRs that were merged. Can you confirm?
As a Maven user I'd expect a Maven property like:
to build local variable information into the .class files to be viewed in the debugger as documented.
In dev mode, IIUC, we initially use the maven-compiler-plugin but then later, if the class is changed while dev mode is active, we switch to a one-off invocation of javac.
So if you don't make any changes the configured debug level will be in effect, but once you do, they're lost.
Maybe this property should be passed along into our custom javac invocation?
I guess one could ask if any other compiler plugin config like 'compileArgs' should be honored..but I was just starting from an actually observed need (of mine).