How can I include the jboss-client.jar present in the Wildfly bin/client folder to my maven project? - maven

I have a maven project to which I have to add a external jar jboss-client.jar which is located in Jboss Wildfly 10 bin folder(bin/client). There is no version specified in the jar name.
When I add the jar manually in build path-it works fine.
However, since this is a maven project, I require a better way of doing this.
Note: The project works with only this jar and not other versions specified in pom.xml which I tried downloading.
Also, if I try to specify the external dependency in pom.xml, it asks for version of the dependency. However, I cannot specify the same as it is not mentioned in the jar.
My ultimate aim is to deploy this project in Jboss Wildfly 10.
Is there any other alternate way, I can add the jar?

Copy your jar to some other location and unzip/decompress it, then find Manifest file located at META-INF\MANIFEST.MF path.
Open it in text editor and look for Implementation-Version.
It will give you the version.
Reference

You can use maven to install third party library in local.
https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
Using below command you can install.
mvn install:install-file -Dfile=path-to-file/jboss-client.jar -DgroupId=org.jboss -DartifactId=jboss-client -Dversion=1.0

Related

Setting name of jar file while using mvn install:install-file

So previously I was trying to find a way to install jar file which is built in my project to the .m2 folder via run configuration support.
Link for reference.
My main concern then was to not keep any hard coded values in command and to pick most data from pom.xml file. This was achieved successfully, but now I have another problem.
In the project, I have 2 modules module1 and module2.
When module1 is built, it generates 2 files a war file since it is a web based application and second one is jar file which is used to satisfy dependencies of other modules.
The jar file is generated using
<attachClasses>true</attachClasses>
property set in the maven-war-plugin in pom.xml of module1.
So if the module1 artifact id is set as module1-corp, then the jar file is named as module1-corp-classes.jar if the jar is installed using maven-install-plugin. But due to the legacy structure of the project, maven-install-plugin cannot be used and I have to use maven command line via Intellij run configurations to install this file.
So the command I used is
mvn install:install-file -Dfile=${project.build.directory}/${project.build.finalName}.jar -DgroupId=${project.groupId} -DartifactId=${project.artifactId} -Dversion=${project.version} -Dpackaging=jar
This installs the jar file perfectly, only it doesn't append the classes part at the end of jar file. so my jar file is now installed as module1-corp.jar instead of module1-corp-classes.jar which is not working okay with modules which are dependent on it.
I suspect this is due to the way module1 dependency is accessed in module2 which is as follows:
<dependency>
<groupId>module1.groupid</groupId>
<artifactId>module1.artifactId</artifactId>
<version>${module1.version}</version>
**<classifier>classes</classifier>**
</dependency>
This code is in the module2 pom.xml. I believe the classifier part is what is causing the issue, but I cannot change this since it is a legacy project.
So in the end I have two options only
Rename the jar while it is being installed via maven command line
Some other way which can rename the jar via an Intellij run configuration.
I tried using following flag
mvn install:install-file -Djar.finalName=jarname
But this doesn't seem to work as expected.
The install maven plugin allows also to specify the classifier (see: here). So in your example the command would need to be changed to:
mvn install:install-file -Dfile=${project.build.directory}/${project.build.finalName}.jar -DgroupId=${project.groupId} -DartifactId=${project.artifactId} -Dversion=${project.version} -Dpackaging=jar -Dclassifier=classes

where to place customer jar in maven project structure

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

How to add dependency to my pom.xml?

I want to use https://code.google.com/p/droidpersistence/source/checkout but I don't know how add to my pom.xml..
The link you provided specifies a place you can download some code, using Subversion:
svn checkout http://droidpersistence.googlecode.com/svn/trunk/ droidpersistence-read-only
So run that command, and it will download the code. That particular code is designed to be built with ant, instead of maven. You need to write a little pom.xml file for it, so that when you build it on your computer with "mvn clean install", maven will generate a .jar file (the artifact), and put it in your local maven repository (.m2 directory). Then add a dependency on that jar to your pom file.
In general, to add a dependency to your pom using the latest version of IntelliJ Idea (12.1.6), click somewhere in your pom file, and press ALT-INSERT, then choose "dependency".
Hope this helps!

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

maven - how does it work? Missing some some jars

I am trying to move my MyEclipes projects to maven. But of course there are problems. After creating a web priject I get missing jar files - about 5
org.springframework.security jar files e.g. org.springframework.security.ldap-3.0.5.RELEASE
show as missing in the jar build path. They are not in the corresponding .m2 directory. I un-installed ME4S, and deleted .m2, which force .me to be rebuilt on re-install, but it has the same problem.
How do I fix this?
It would be very helpful to understand how the .m2 process works - where is this coming from and how is it controlled?
I am not sure about the MyEclipse part, but this seems to be a pure maven question.
Maven (2/3) uses the pom.xml. This file describe your project. In that file you should define a list of dependencies (which can have their own dependencies and so on).
Maven read the pom.xml and build the classpath accordingly using direct and transitive dependencies.
You can use the mvn dependency:tree command to see how your classpath is built.
More on the plugin page

Resources