Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axxerion #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Axxerion #5

wants to merge 2 commits into from

Conversation

ErikEngerd
Copy link

I have modified the plugin.
Previously the dependencies were instrumented but not the java classes compiled by the local java project.

This can occur when a project is built that does not compile code but
where the plugin is used through a parent pom.
Previously the plugin instrumented only  class files in the
dependencies.
Now it loads all the classes in the compile class path but instruments
only the class files that are compiled in local maven project.
final List<String> classpathElements = getCompileClasspathElements();
loadClassPath(originalContextClassLoader,
generateClassPathUrls(classpathElements));
transform(Arrays.asList(project.getBuild().getOutputDirectory()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you have a "inline setup" in which you define maven-javassist-plugin in the project directly in order to replace the compiled classes with the altered version.

Your change does not take into account that the maven-javassist-plugin can also be used in a separate project so the altered classes are bundled in a separate jar. (See README.md)

private List<String> getCompileClasspathElements()
throws DependencyResolutionRequiredException {
List<?> ret = project.getCompileClasspathElements();
ret.remove(project.getBuild().getOutputDirectory());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for both type of setups

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants