Skip to content

Issue #161: ITs fail on Java 11 #162

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

Merged
merged 2 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/it/simple/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgs>
<arg>-Xlint</arg>
</compilerArgs>
</configuration>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>com.github.wvengen</groupId>
Expand All @@ -39,6 +35,14 @@
<configuration>
<attach>true</attach>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Expand Down
2 changes: 0 additions & 2 deletions src/it/simple/proguard.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
-libraryjars <java.home>/lib/rt.jar

-dontnote
-dontwarn

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,27 @@ private void attachTextFile(File theFile, String mainClassifier, String suffix)

}
}

private Set<File> getAllPluginArtifactDependencies(ProGuardMojo mojo) throws MojoExecutionException {
Set<File> files = new HashSet<>(getProguardJars(mojo));
for (Artifact artifact : mojo.pluginArtifacts) {
files.add(artifact.getFile().getAbsoluteFile());
files.addAll(getChildArtifacts(artifact));
}

return files;
}

private Set<File> getChildArtifacts(Artifact artifact) {
Set<File> files = new HashSet<>();
for (Object child : artifact.getDependencyTrail()) {
if (child instanceof Artifact) {
files.add(((Artifact) child).getFile().getAbsoluteFile());
files.addAll(getChildArtifacts((Artifact) child));
}
}
return files;
}

private List<File> getProguardJars(ProGuardMojo mojo) throws MojoExecutionException {

Expand Down Expand Up @@ -984,8 +1005,10 @@ private void proguardMain(Collection<File> proguardJars, List<String> argsList,
java.setTaskName("proguard");

mojo.getLog().info("proguard jar: " + proguardJars);

Set<File> allDependencyFiles = getAllPluginArtifactDependencies(mojo);

for (File p : proguardJars)
for (File p : allDependencyFiles)
java.createClasspath().createPathElement().setLocation(p);
// java.createClasspath().setPath(System.getProperty("java.class.path"));
java.setClassname(mojo.proguardMainClass);
Expand Down