mendix-userlib-cleaner icon indicating copy to clipboard operation
mendix-userlib-cleaner copied to clipboard

Use java code parsing to determine if jars are required

Open xiwenc opened this issue 3 years ago • 5 comments

High level:

  • Walk through all java files in the project

  • Create list of classes with full names. E.g. org.json.blaat.hello

  • Walk through all jars and create list of all classes with full names also

Compute the difference and identify which jars can be removed.

xiwenc avatar Mar 14 '22 17:03 xiwenc

Looks good , I would like to pick this up if it is already not taken ?

zeeshantariqrafique avatar Nov 15 '22 14:11 zeeshantariqrafique

Hi Zeeshan, feel free to implement this. Didnt get around to do this yet.

xiwenc avatar Nov 15 '22 15:11 xiwenc

There is one catch (challenge): how to deal with transitive dependencies. Not all jars will have a direct dependency from a java file. How do we know a jar depends on another jar?

xiwenc avatar Nov 15 '22 15:11 xiwenc

There is one catch (challenge): how to deal with transitive dependencies. Not all jars will have a direct dependency from a java file. How do we know a jar depends on another jar?

Hi Xiwen, That is a good point you make Maven or extract byte code (.class) from jar and check for class duplicity comes to mind.

zeeshantariqrafique avatar Nov 15 '22 16:11 zeeshantariqrafique

Yes that's a great idea. Reverse generate a mvn pom.xml.

xiwenc avatar Dec 17 '22 10:12 xiwenc