In my maven project, I'm creating a jar locally and specifying it in pom as a dependency. In GitHub action install step is working mvn install:install-file and it is installing jar at location /root/.m2/repository/.
But in the next command to run tests mvn clean test it's checking that dependency in maven central and failing. How do we use dependency locally installed in case of GitHub action?
Related
I have a Spring boot project on my local machine and I am using personal dependencies in the project. When I run mvn clean package on the windows terminal it works but when I use mvn clean package in the Jenkins Job it does try to download dependencies in the remote repository. My question is how to force Jenkins to use my local repository without looking the remote one.
You should able to use maven option mvn -o or mvn -llr.
But that assumes ~/ is the same user Jenkins agent ia running on.
Your better bet is to use mvn install:install-file to install the jars locally.
You can set up your job to do a curl.or wget step to retrieve the files from "somewhere", then have your pom call a pom which installs the jars locally from workapce to repo, then does your build.
That makes your job portable and still pulls the rest of OSS jars from Central, without needed an intermediary remote.
I usually use mvn versions:use-latest-versions command to update my dependencies to the latest ones which other teams have been deployed to our free Jfrog's Artifactory server on our local address : http://192.168.100.243:8082/artifactory/X_Douran/.
My problem is when I deploy an artifact (a jar file) with Artifactory UI or with curl (using Jfrog's Rest Api), the command mvn versions:use-latest-versions doesn't work correctly and do not update my pom but when I run mvn clean deploy on my source code of my dependent project then running mvn versions:use-latest-versions on my final project it works correctly and do update my dependency in my pom.
So I want to know what is the different between deploying via Artifactory UI and deploying via mvn clean deploy ?
You always need to deploy the POM along the JAR, otherwise Maven will not work correctly with these dependencies. Furthermore, you need to make sure that the metadata files are updated. I am not sure that Artifactory does this if you deploy using curl or the UI.
Deploying your own JARs regularly through the UI is not recommended. You should build them on a build server (like Jenkins) and then automatically deploy them to Artifactory.
Changing JAR files "by hand" should be forbidden.
I have child project with some dependencies. When I upload this jar to nexus it's ok.
But when I use this jar in my webapplication and I use mvn clean install -U command. Maven create a war, but the child project dependencies isn't in the war lib folder.
What is the problem?
Check with mvn dependency:tree on the project. Often, the problem is a wrong scope. Make sure the dependencies all have scope compile.
I have issue with Project Building in Maven. I have updated some code in one of the dependency jars which is available in Maven Repository .I need to build my project with the jar i have modified.How to do that .Kindly Help me.
1. Install mvn project
Make sure to install your changed code into your repository.
Run following maven command for your updated library project.
mvn install
2. Check dependency
Check if the version of your library project match with the dependency entry in your main project pom.
E. g. if you install version "1.1" make sure the dependency entry is also "1.1"
I have a dependency application jar from other maven applications,and currently added it to my application path,
I want to know how this application related jar can be automatically moved my local repository folders.
I think it should be placed in somewhere in maven project folder structure so that when maven build the module it automatically moves to the repository.
Dependent project:
If built with maven, you would issue a mvn install, when building it.
If not built with maven, install it locally using mvn install:install-file
http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html