I am writing a maven plugin to control another java program (jar). This jar needs two dlls in the same directory. I would like to install the jar and this two dlls as a maven repo into local .m2 dir or a maven repository server.
I have used following command to create the local repo for the jar within my project:
mvn org.apache.maven.plugins:maven-install-plugin:2.5:install-file -Dfile=protector.jar -DgroupId=com.protect -DartifactId=protector -Dversion=10.0 -Dpackaging=jar -DlocalRepositoryPath=lib
But now i do not know how i can get the dlls in the same dir like the jar file. If i use the above command then maven creates new folder for each dll and rename it.
Anybody knows a solution?
Related
In one of our project we are planning to generate multiple jar files (basically libraries, which contain no dependencies) .
We would like to upload these jar files to local maven repository (Archiva looks good, we are also open to other options) so other developers can simply use them.
(Single jar file deploy works great)
PS: We are using maven.
Thanks in advance.
When you build your jar files with Maven, you simply call mvn deploy (having a correct settings.xml) and the jar goes into your Maven repository.
If you have jars not built with Maven, you can use mvn deploy:deploy-file to upload them.
I'm creating a base framework and distributing it as a jar file. Other developers will use this jar in the web application. others are going to use mvn install:install-file to install the jar in the local repository.
if i try to use the jar in the war , the jar dependencies(jar contains the POM file) are not available in the war. Then i included the pom file in the install command then it worked correctly.
mvn install:install-file -Dfile=path-to-file -DpomFile=path-to-pomfile
The jar file already contains pom file with dependencies,Then why do i need to include the pom file in the install command explicitly.
Is there any alternate ways to pull the dependency available in the jar(POM file) to the war file. otherwise unnecessarly i have to provide the jar and POM file to others.
Thanks,
Sampath
The war project should have its own POM file specifying a dependency on your jar project. In this way, when you build the war, your jar and all its dependencies would be pulled into the war automatically.
In order to distribute artifacts among your fellow developers you should install a repository manager, such as Nexus.
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
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
Given a project with <packaging>something-not-jar</packaging>, how does one:
tell the maven-jar-plugin to produce the "normal" jar file and tell the maven-install-plugin to take that normal jar file and
install that to the local repository (in addition to the something-not-jar artifact that was produced)
If I tell the jar plugin to produce a test-jar, then it does that and the install plugin installs the xxx-0.0.1-SNAPSHOT-tests.jar to the local repo. But the "jar" goal apparently does not cause the resulting jar file to be installed in the local repo, even though the jar file is created in the target folder.
So how do I do this?
You should simply do the following:
mvn install