Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validate java compact profile for all dependencies

Tags:

java

maven

I try to evaluate whether my java program as well as all of its dependencies (including transitive ones) fit the java compact3 profile.

I can compile my program with the -profile compact3 compiler switch, but this will only check my program.

How can I automatically (e.g. using maven) validate that all dependencies meet the profile requirement? I could checkout the source for all dependencies and build them manually with the above compiler switch, but this is impracticable.

like image 857
m.s. Avatar asked Dec 06 '16 11:12

m.s.


1 Answers

There is a jdeps-maven-plugin that is suitable for your use case

Add this to pom.xml

<build>
  <plugins>
    <plugin>
      <groupId>com.github.marschall</groupId>
      <artifactId>jdeps-maven-plugin</artifactId>
      <version>0.4.0</version>
      <configuration>
        <profile>true</profile>
        <recursive>true</recursive>
      </configuration>
    </plugin>
  </plugins>
</build>

Then run

$ mvn jdeps:jdeps

Unfortunately the plugin does not support automatic failing of builds if profile requirements are not met, but one can write an external script to process the output.

e.g.

mvn jdeps:jdeps | awk '/    ->/ && /Full/ {print}'
like image 112
anttix Avatar answered Nov 09 '22 23:11

anttix