I have a library consisting of 4 jars:
matlabcontrol-4.1.0.jar
matlabcontrol-4.1.0-javadoc.jar
matlabcontrol-4.1.0-sources.jar
matlabcontrol-demo-4.1.0.jar
How do I add them to the local repository so that Maven knows where sources are and where javadoc is?
Documentation here http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html is very brief and does not answer this question.
The documentation clearly mentioned the way. Think your matlabcontrol-4.1.0.jar in C:> location. So move your cmd on C:> location and run following command.
mvn install:install-file -Dfile=matlabcontrol-4.1.0.jar -DgroupId=org.matlabcontrol \
-DartifactId=matlabcontrol -Dversion=4.1.0 -Dpackaging=jar
If you do that, you can access your jar file with dependency, like:
<dependency>
<groupId>org.matlabcontrol</groupId>
<artifactId>matlabcontrol</artifactId>
<version>4.1.0</version>
</dependency>
Classifiers can also be specified at the command-line. See http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html#classifier.
Javadoc and sources are just artifacts with a classifier of the same pom.
For example:
Install the main artifact
mvn install:install-file -Dfile=matlabcontrol-4.1.0.jar
-DgroupId=matlab -DartifactId=matlab -Dversion=4.1.0
Install the javadoc using the classifier javadoc:
mvn install:install-file -Dfile=matlabcontrol-4.1.0.jar
-DgroupId=matlab -DartifactId=matlab -Dversion=4.1.0 -Dclassifier=javadoc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With