Is there any difference between run maven as sudo and without sudo? - maven

I am using maven and JavaFX Maven Plugin. Maven will download jar from repository and save it to ~/.m2 directory. But if I use maven as sudo. For example, if I type sudo mvn com.zenjava:javafx-maven-plugin:2.0:fix-classpath, is there any difference with the command without sudo? Does maven download the plugin and save it to ~/.m2 as well?
I ask this question because I run this command both under sudo and no-sudo. It seems maven will re-download the plugin each time.

I think your question is related to this one.
So the answer to your question, would be if you are not changing the home directory while executing sudo, maven will download plugins to your user .m2 directory.

Related

Is it possible to install rpm package from a Nexus yum repo using Maven?

I would like to create a zip with some files and rpm packages using Maven assembly plugin and I would like to know if there is a way to download the rpm from a Nexus yum repository with the pom.xml (as a dependency or anything else).
I have found the rpm-maven-plugin but it can only create an rpm, it can't download it from Nexus.
I have found the solution, I used mvn wagon:
mvn wagon:upload-single -Dwagon.serverId=<ServerID> -Dwagon.url=http://<ServerUrl>/repository/<NexusReposirory>/<RPM file name> -Dwagon.fromFile=<RPM file>

Maven install plugin not found

I have to add some .pom files to the local .m2 repository and I am working on an offline system.
After successfully installing maven (checked with mvn -v) i tried to install the desired files using mvn install:install-file -Dfile=<Path/to/pom>.
However, this leads to a NoPluginFoundforPrefixException, because the prefix "install" is apparently unknown. Trying to download it from the central repository after execution obviously fails since the computer is not connected to the internet.
How can I get mvn install to work?
For the first time you need to use internet, so that your local/central repository get all the plugins which required to use mvn install.
Then you can work on offline mode.

Can't find maven in OS X Yosemite 10.10.4

Nothing when I type:
$ whereis mvn
but I guess it is somewhere because from Eclipse I can select a pom.xml file and run it as maven build
As pointed out in the comments, Eclipse brings its own bundled Maven. If you want to use Maven on the shell, I suggest you install Homebrew and then install Maven like this:
brew install maven
After that you should be able to use mvn on the command line.
By the way, to find out where mvn is, use:
which mvn

Install Maven on Ubuntu

I am not able to install maven in Ubuntu 12.04
I tried : sudo apt-get install maven
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package maven is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'maven' has no installation candidate
when i run : apt-cache search maven
libapache-pom-java - Maven metadata for all Apache Software projects
libcommons-parent-java - Maven metadata for Apache Commons project
maven-ant-helper - helper scripts for building Maven components with ant
maven-repo-helper - Helper tools for including Maven metadata in Debian packages
libjenkins-plugin-parent-java - Jenkins Plugin Parent Maven POM
I am getting a message like this. How to resolve this ?
First search for Maven package....
For that run this command in terminal..
apt-cache search maven
Then install...
sudo apt-get install maven
And at last for verification...
mvn -version
Hope this will help you.... ;)
Download maven from apache maven official site and extract.
Move the application directory to /usr/local
sudo cp -R apache-maven-X.X.X /usr/local
Make a soft link in /usr/bin for universal access of mvn
sudo ln -s /usr/local/apache-maven-X.X.X/bin/mvn /usr/bin/mvn
Verify mvn installation
mvn --version

How to install artifacts into the local gradle filestore

Can anyone tell me how to install an artifact/project into the local gradle filestore?
gradle install
installs it to the local maven repository but I need to have it in
~/.gradle/caches/artifacts-15/filestore
It's a pure cache, and you can't install into it (by design). If you could, reproducibility would suffer (build works on one machine but not on another).
If you install it to your local maven repository and refer to the repository in you gradle build file, you will have solved your problem.
See
Is there a way to install jar local gradle repository, as it in mave (maven install:install-file
EDIT: You don't even have to install the jar into your maven repo:
https://stackoverflow.com/a/13531958/260122

Resources