Maven not finding dependency with only jar file - spring-boot

I have a jar in artifactory without pom. when I try to download it from maven/gradle, it is not being found with an error "Could not find com.kroger.galactus:koop-order:unspecified". My question is, is it possible to download artifact from artifactory which only has jar file and no pom file?
edited:
since it is not possible to download without pom file.
I have a third party jar file which I need to upload to artifactory. I used curl -X PUT -u u:p -T Maven-Upload-1.1.jar "https:///artifactory/repo/Maven-Upload-1.1.jar", which uploaded jar file.
Is there other way to upload it so it can create pom file in artifactory?

If there is no POM, you need to create one. You can e.g. do this through the artifactory REST api, possibly through the UI as well.

As Fabian mentioned earlier, this can be fixed by generating the POM for the library. This can be achieved by using this Generate POM REST API.

Related

Customize build and release role in maven

I have a Non-Java Maven project. By default the deploy goal generates a JAR file, however I would like to generate a zip file instead that should be published to nexus at a later phase.
If I create the zip file manually and place it in the target folder, Maven is not publishing it to nexus, it only publishes the JAR file automatically created.
So my question is: Is there any way to upload to nexus all the content of the target folder? If not, how do I tell Maven not to create a jar file and create a custom zip instead?
Maven has the deploy:deploy-file goal which can be configured in your pom.xml It can be used to upload arbitrary files, including zips.
You can avoid the creation of a jar if you change <packaging> to pom.

Artifactory or Nexus deploy Jar and Pom

I've got a compiled Jar file and a Pom file. Now I want to deploy both of these to Artifactory or Nexus (I've got both).
I want to do it with either mvn:deploy or curl (REST API)
could someone tell me how I do this?
My answers are about Artifactory, of course.
For using mvn deploy you need to configure your pom file to include distributionManagement tag. You can copy-paste the whole tag from Artifactory UI (click on the repository you want to deploy to, on the right side you'll see the distributionMnagement tag for copying).
With REST API you can just issue two PUT requests (one for pom, other for jar). Start with the pom.
If you got a jar file already as well as a pom, you would want to use the deploy-file goal of the Maven deploy plugin. mvn deploy will build the project but that wont work if you already got the jar and pom file and no source code.
Of course you can also upload the files via the web user interface of Nexus or use the REST api. You can find some REST api examples with curl on github.

maven - how to deploy non-jar files

In my project I have many modules.
One of the modules requires a jar file to be deployed to the repository which it does fine.
The others involve every other kind of file: zip, kar etc.
I can see the zip get uploaded if I look for it via the terminal but if I browse Archiva it is not there.
The kar file, for example, does not need to be built but it's being worked on and is currently manually uploaded to the repository (Archiva). This is not desirable.
Each module has a POM and each POM uploads empty jar files to Archiva when it is built (with Jenkins). How can I avoid that? And can I copy files to Archiva without them having to be built into a jar file?
You can also give a try to "maven-deploy-plugin"
Invoke a maven target in jenkins with this plugin and provide the suitable parameters.
You would also need the repository to be added in you settings.xml if your repository requires login credentials and then use the ID, you mentioned in settings.xml, in the maven target.
org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file
-Durl=<artifact-repo URL>
-Dfile=<name of the file>
-DgroupId=<Group Id>
-DartifactId=<Artifact Id>
-Dversion=<VERSION>
-Dpackaging=<packaging Type>
-DrepositoryId=<ID as mentioned in settings.xml>
Hope this may be of some help.

Ignore POM in 3rd party JAR

I have uploaded a 3rd party JAR file to my Artifactory repository. This JAR file contains a POM, but the pom is only valid inside the 3rd-parties build environment.
When I attempt to build a project that uses this JAR, I get errors because it is looking for a parent project that we don't have access to.
I understand from this post that this is because the POM is being read from inside the 3rd party Jar.
Is there a a way to edit the POM of our project to tell Maven to ignore the pom of this 3rd party Jar?
(as a workaround, I can remove the POM from the Jar - this fixes the issue, but I would prefer not to have to remember to do this on every release of this 3rd-party component).
Please also note that I am very new to Maven, so use short words and long explanations ;-)
The best way to fix it is to deploy the parent pom to Artifactory. That's how Maven works.

I want to include a jar file in my build using maven

The problem is like this
I have a maven build of my project already. But I have a requirement wherein I need to replace a .jar file located in WEB-INF/lib folder with another .jar file. This new jar file can be downloaded from a link.
What changes do I have to make in the pom.xml file to achieve this requirement. I tried to find out ways to do it but could not figure out the exact solution as I am a novice in Maven.
Assuming that the jar file is not found in any public maven repository you can install it in your local repository using the install plugin mvn install:install-file ... and refer it as any other dependency

Resources