1

I am working on a legacy app and its in Ant build. Now we are moving it from Ant to Maven which requires dependency config of jar files in pom.xml. There are some 60 jars for which I need to generate this info. I have tried below 2 methods for getting jar versions:

  1. generate jar checksum and check the corresponding jar on [https://search.maven.org/][1] using checksum
  2. generate manifest file of jar and check implementation-version or bundle-version and find out the jar dependency details through the version found.

This has worked for most of jars, but there are some 25 jars for which none of above methods are working.

Checksum is generated for all but for these remaining jars, checksum doesn't give anything on [https://search.maven.org/][1]

And for some, no version detail is there in manifest file.

Please let me know how to proceed with this, I am stuck here now. I don't know what can work here for such jars.

Even if I find no details for some jars, what can be way to still include them in my pom file - is there a way or not? If not, can I simply keep them as jars only instead configuring in pom?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

1 Answers1

3

If you really want to update the project, I would take these 25 jars and look in MavenCentral if there any version of them.

So if you just find junit.jar in your directory, add a reasonably new version of junit.

Of course, this might break things that need to be repaired, but in going forward, it is better to rely on official, new artifacts.

If this is not possible for some artifacts, add them to your company Nexus/Artifactory if you have one.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
  • Hey Fabian , thanks for the answer , but for some jars out of these 25 , i couldn't find any details on maven central or anywhere else . What can be done for such jars Secondly , for the ones i could see on maven central , but due to lack of version details , i cant add any version in pom as it will break the project as its just not for one jar , there are multiple jars and for all if i add latest version , it would be very difficult to track down project broke because of which – Shweta Priyadarshani Jul 28 '20 at 09:23
  • And can you elaborate the last option you gave or can i just manually add these jars in my local repo or have them in project without dependency config in pom.xml – Shweta Priyadarshani Jul 28 '20 at 09:23
  • Does your company not have a Nexus/Artifactory? You can install them to the local repository and then add them in the POM, but then it will only work on your computer. – J Fabian Meier Jul 28 '20 at 09:27
  • My company has its own repository - i couldn't find the 25 jars there also. When you say install them in local and add them in POM, how can that be done if i dont have any version , groupid , artifactid details of jars and just their names. This is where i am struggling. That's why i asked if i can just let them be in my project lib and not configure in pom file. – Shweta Priyadarshani Jul 28 '20 at 09:38
  • You need to invent the groupId, artifact and version. Then you can install it in your local repository and put it in your POM. Even better would to ask the admin of your company repository to upload them. You cannot use them in a Maven project if they are not in the POM. – J Fabian Meier Jul 28 '20 at 11:09
  • So basically you mean i have a jar - **xyz** , with no other details about artifactid , groupid , version. So i can just create the dependency myself giving any random values as : ` com xyz 1.1 ` and then i can have this jar in my local repo + get it uploaded on companies maven repo too. An additional step would be to give the dependency config above to this jar file that i have Please let me know if i am correct – Shweta Priyadarshani Jul 28 '20 at 11:44
  • You can upload it with these coordinates and then you can use it in your project as ``. I did not really understand what you mean by config. – J Fabian Meier Jul 28 '20 at 11:56
  • by config i meant the coordinates of the jar, the details of jar. I got it how you said , let me try out, Thanks much for the time and help :) cheers – Shweta Priyadarshani Jul 28 '20 at 12:09