Best way to identify unused jars or invalid versions?

3
Hi there, I just used Jboss Tattletale to try to identify unused jars in our project.  Is this is safe way to identify unused / invalid jars (taking reflection into account ect) Is there a better more automated way to deal with this? (As removing one by one, running and testing is quite slow and tedious)    Any information would be appreciated! Thank you in advance.
asked
5 answers
2

It also helps to check for duplicated names or higher versions, remove them and rebuild and check for errors. Also make sure you have a backup.

answered
1

If you did not add any jarfiles manually, you can do a cleanup bij deleting everything from userlib and then do a fresh import from the appstore for all appstore components.

If you are not sure, you could also make a backup of the original userlib folder, do the cleanup and then compare the userlib with the backup.

answered
1

Hi Bertram

Remove and import from app store, might a good option if your jars are only used by the apps store modules. It could be that some of the custom Java Actions might depend on some others..

A good way to do this, without re-starting the project every time. 

  1. Open the project in the Studio Pro
  2. Open the project in Eclipse.
  3. Move all jar files to a backup folder
  4. In studio run deploy for eclipse
  5. Refresh the project in eclipse
  6. Check for errors (import error)
  7. Restore the jar files that are thing that are missing to fix the import
    1. Repeat step 4 to 6 until you have no error.
    2. Higher major version of a jar file is not always a better choice…. so play around with it. 
  8. Restart your app.

 

Cheers, Andries

 

About dependency management

A great blog  https://www.mansystems.com/blog/mendix/managing-java-dependencies-for-mendix-modules

Applied in community commons modules, see https://github.com/mendix/CommunityCommons/

answered
0

Do note that reimporting all modules could still result in double jar files if that jar is used by multiple modules with different versions. So afterwards you still need to manually check.

Regards,

Ronald

 

answered
0

A bit antiquated, but implementing something similar to loosejar with a runtime interface would be helpful so your mendix website can generate a list of which jar files are unused. Then you can make a java action that diffs the $PROJROOT/userlib/*.jar with the list to produce a difference, then backs that up to say $PROJROOT/userlibbak and removes them from $PROJROOT/userlib. So if any brainbox can come up with that I’d say that would be a useful module.

answered