Where is my m2 folder on Mac OS X Mavericks - maven-2

I cant seem to find the local .m2 folder on Mac OS X mavericks. Ideally it should be at {user.home}/.m2 but I cant seem to find it.
Should I create it?

If you have used brew to install maven, create .m2 directory and then copy settings.xml in .m2 directory.
mkdir ~/.m2
cp /usr/local/Cellar/maven32/3.2.5/libexec/conf/settings.xml ~/.m2
You may need to change the maven version in the path, mine is 3.2.5

On the top of the screen you can find the Finder. Click Go -> Go to Folder -> search ~/.m2
If it is not found, as m2 is a hidden file you need to enable visibility by typing the following command in terminal:
defaults write com.apple.finder AppleShowAllFiles YES

Go to finder:
Press on keyboard CMD+shift+G . it will show u a popup like this
Enter path ~/.m2
press enter.

It's in your home folder but it's hidden by default.
Typing the below commands in the terminal made it visible for me (only the .m2 folder that is, not all the other hidden folders).
> mv ~/.m2 ~/m2
> ln -s ~/m2 ~/.m2
Source

If you search directly it won't appear so please follow as below steps to see .M2 repository path.
Go-> Find folder -> type this "~/.m2" and click go
If Maven is already installed and used, the .m2 will be listed.
Source

By default it will be hidden in your home directory. Type ls -a ~ to view that.

On mac just run mvn clean install assuming maven has been installed and it will create .m2 automatically.

You can try searching for local .m2 repository by using the command in the project directory.
mvn help:evaluate -Dexpression=settings.localRepository
your output will be similar to below and you can see local .m2 directory path as shown below: /Users/arai/.m2/repository
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.jar
Downloaded from central: https://repo.maven.apache.org/maven2/net/sf/jtidy/jtidy/r938/jtidy-r938.jar (250 kB at 438 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/commons-codec/commons-codec/1.11/commons-codec-1.11.jar (335 kB at 530 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/jdom/jdom2/2.0.6/jdom2-2.0.6.jar (305 kB at 430 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.jar (500 kB at 595 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.4.11.1/xstream-1.4.11.1.jar (621 kB at 671 kB/s)
[INFO] No artifact parameter specified, using 'org.apache.maven:standalone-pom:pom:1' as project.
[INFO]
/Users/arai/.m2/repository
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.540 s
[INFO] Finished at: 2019-01-23T13:57:54-05:00
[INFO] ------------------------------------------------------------------------

Go to your root folder
Shift + Command + .
press this then you can see all the hidden files. Because your .m2 file suppose to be a hidden folder

Open your terminal
Type open ~/.m2
It will open .m2 folder in explorer

Related

elm-make: elm-package.json: openBinaryFile: does not exist

I do a fresh installation: npm i elm#0.18 -g
I try to build using: elm-make ./src/scripts/MainModule.elm
I get:
elm-make: elm-package.json: openBinaryFile: does not exist (No such file or directory)
But the elm-package.json file is right there in the directory where elm-make is called from.
Thoughts?
Note: I'm using nvm, in case it matters.
I am able to reproduce the error by deleting elm-package.json, but leaving the elm-stuff/ directory. You should be able to fix this by deleting your elm-stuff/ directory and letting elm-make rebuild the project for you.
For reference, issue here: https://github.com/elm-lang/elm-make/issues/171
#HParker is right, the only way to reproduce it is following these steps:
Run elm-make and let it install all the dependencies
Remove elm-package.json file
Run elm-make again
If it's not your case you can debug what's going using strace, e. g.
strace -yfv elm-make 2>&1 | grep elm-package.json
Example output:
[pid 32319] openat(AT_FDCWD, "elm-package.json", O_RDONLY|O_NOCTTY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
[pid 32319] write(2<pipe:[427229]>, "elm-package.json: openBinaryFile"..., 76elm-package.json: openBinaryFile: does not exist (No such file or directory)) = 76
If it tries to open elm-package.json in current working directory you will see AT_FDCWD variable, if not you should see the full path.
The problem was that package authors were updating packages to support elm .19 by changing elm-package.json to elm.json but not bumping up major versions of their packages.

The libgit2 examples are not building properly

I have built libgit2 on my Ubuntu 16.04 machine, and everything seemed fine. I ran make in the /examples directory and when I try to run ./log I get the following:
./log: error while loading shared libraries: libgit2.so.26: cannot open shared object file: No such file or directory
But, in the /build folder I indeed have both libgit2.so and libgit2.so.26 so I am not really sure what I am missing. I can post more info if it is needed. I am using cmake version 3.5.1.
The Makefile in the examples will provide guidelines for usage, which should be suitable when you have actually installed libgit2 into system library locations.
To build the examples within the source directory, you should use cmake to build the examples. Given a fresh configuration:
$ mkdir build
$ cd build
$ cmake .. -DBUILD_EXAMPLES=ON
$ cmake --build .
...truncated...
$ examples/log
commit 8ac8c78c35905f7f9cc37f240c3d633a7cc5a5e3
Merge: 34ec6f3 4955125
Author: Edward Thomson <ethomson#edwardthomson.com>
Date: Mon Oct 9 15:15:08 2017 +0100
Merge pull request #4356 from pks-t/pks/static-clar
cmake: use static dependencies when building static libgit2
...truncated...

cms.war - No such file or Directory

I try to install a test version of hippocms. I stuck in
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45:21 min
[INFO] Finished at: 2017-02-16T15:18:32+01:00
[INFO] Final Memory: 16M/200M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.19:start (cargo-run) on project gogreen: Execution cargo-run of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.19:start failed: Failed to create deployable with implementation class org.codehaus.cargo.container.tomcat.TomcatWAR for the parameters (container [id = [tomcat8x]], deployable type [war]). InvocationTargetException: Failed to parse Tomcat WAR file in [/courierOS-7.x/p.rader/Downloads/developer-trail-11.0.2-iteration-2/cms/target/cms.war]: Failed to find file [/courierOS-7.x/p.rader/Downloads/developer-trail-11.0.2-iteration-2/cms/target/cms.war]: /courierOS-7.x/p.rader/Downloads/developer-trail-11.0.2-iteration-2/cms/target/cms.war (No such file or directory) -> [Help 1]
Any idea?
Today I repeat mvn clean install -X and it worked fine.
For every other guy who came here by search: The -Pcargo.run uses tomcat and the built-in tomcat-users.xml so the only valid account is admin and password admin like tomcat does.
Have you tried a clean install before running cargo?
mvn clean install && mvn -Pcargo.run
edit:
The more modern way of doing it would be:
mvn clean verify
and then do your cargo.run.
see also Build Project

Maven: Trouble deploying third party JAR to a remote repository

I'm using Maven 3. I'm trying to deploy a third party artifact to a remote repository but am getting a strange error. The command I'm using to deploy is
mvn deploy:deploy-file -DgroupId=com.myco.util.ant \
-DartifactId=selenium-ant-task \
-Dversion=1.4 \
-Dpackaging=jar \
-Dfile=/Users/davea/.m2/repository/com/myco/util/ant/selenium-ant-task/1.4/selenium-ant-task-1.4.jar \
-DrepositoryId=sonatype-nexus \
-Durl=http://sonatype.myco.com/nexus/content/repositories/releases
And the error I get when I run this command is
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file (default-cli) on project maven-selenium-plugin: The parameters 'url' for goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file are missing or invalid -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
What's going on here? I have defined my repositoryId, "ssonatype-nexus" in my ~/.m2/settings.xml file and verified the credentials in there are correct.
Thanks for any help, - Dave
deploy:deploy-file is not intended to be run in a directory with a pom.xml file - you should run it somewhere else. If you want a specific POM uploaded with it, don't forget the -DpomFile argument as the default is to generate a basic one.
However, I notice that you're deploying a file from the local repository - if this was placed there by a Maven build you are certainly better to have that project do the deployment, using the <distributionManagement> element and deploy lifecycle phase.
Seems like your url is formatted incorrectly.
Try:
-Durl=file://path_to_m2_repo
See here for more.
Edit: Note, the URL is for the local repo in this case. Maven should deploy to a Nexus based on the POM and -DrepositoryId.

maven and lift using scala 2.8 : lift-mapper missing?

Newbie question since I'm not up to speed using
maven at all.
I'm trying to use scala + lift using scala 2.8, environment
is a win7 box if that matters.
I create a basic project using:
mvn archetype:generate -U -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic -DarchetypeVersion=2.0-scala280-SNAPSHOT -DarchetypeRepository=http://scala-tools.org/repo-snapshots -DremoteRepositories=http://scala-tools.org/repo-snapshots -DgroupId=com.liftworkshop
-DartifactId=todo -Dversion=1.0-SNAPSHOT
So far so good, but then, I try to cd into my new project
and do:
mvn jetty:run
I after quite a few downloads end up with a error like below:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) net.liftweb:lift-mapper:jar:2.0-scala280-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=net.liftweb -DartifactId=lift-mapper -D
version=2.0-scala280-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=net.liftweb -DartifactId=lift-mapper -Dve
rsion=2.0-scala280-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -Dr
epositoryId=[id]
Path to dependency:
1) com.liftworkshop:todo:war:1.0-SNAPSHOT
2) net.liftweb:lift-mapper:jar:2.0-scala280-SNAPSHOT
----------
1 required artifact is missing.
for artifact:
com.liftworkshop:todo:war:1.0-SNAPSHOT
from the specified remote repositories:
scala-tools.snapshots (http://scala-tools.org/repo-snapshots),
scala-tools.releases (http://scala-tools.org/repo-releases),
central (http://repo1.maven.org/maven2)
Any ideas?
I created the same project using the mvn archetype:generate command you provided but I couldn't reproduce your problem. The lift-mapper-2.0-scala280-SNAPSHOT.jar artifact is definitely in the scala snapshots repository and Maven downloaded it:
...
1619K downloaded (lift-mapper-2.0-scala280-SNAPSHOT.jar)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '0c857e2c5de9d5cabb7c972e519528606f19697b'; remote = 'a258cf7d7a49a8d7163d499da06a4d1e231a78e0' - RETRYING
Downloading: http://scala-tools.org/repo-snapshots/net/liftweb/lift-mapper/2.0-scala280-SNAPSHOT/lift-mapper-2.0-scala280-SNAPSHOT.jar
1619K downloaded (lift-mapper-2.0-scala280-SNAPSHOT.jar)
As you can see, Maven had to retry the download because of a failed CHECKSUM check but it worked.
Just try again.