Results 1 to 6 of 6

Thread: How to modify M2_REPO?

  1. #1
    Join Date
    Dec 2008
    Posts
    9

    Default How to modify M2_REPO?

    Hi,

    In STS 2.3.0.RELEASE, how can you change the classpath variable, M2_REPO, to where my repository actually is and not where it thinks it should be, ie. c:\Documents and Settings\myid\.m2\repository.

    Thanks,
    Henry

  2. #2
    Join Date
    Dec 2008
    Posts
    9

    Default

    Quote Originally Posted by freemarket View Post
    Hi,

    In STS 2.3.0.RELEASE, how can you change the classpath variable, M2_REPO, to where my repository actually is and not where it thinks it should be, ie. c:\Documents and Settings\myid\.m2\repository.

    Thanks,
    Henry
    I did work around this by making a shortcut to my real repository. I suspect
    this is by design unmodifiable unlike JBoss Dev Studio or tools.

  3. #3
    Join Date
    Aug 2004
    Location
    Duesseldorf, Germany
    Posts
    1,210

    Default

    freemarket,

    you can modify the location of your repo in the Preferences -> Maven -> User Settings. Point to a custom settings.xml.

    Within that settings.xml you can specify the location of the Maven repo as follows. This should also update M2_REPO variable.

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <settings>
      <localRepository>/Applications/rich-web-2.1.3/repository</localRepository>
      <offline>true</offline>
    </settings>
    HTH

    Christian
    Christian Dupuis
    SpringSource, a division of VMware
    Lead, SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/cdupuis

  4. #4
    Join Date
    Dec 2008
    Posts
    9

    Default

    Quote Originally Posted by Christian Dupuis View Post
    freemarket,

    you can modify the location of your repo in the Preferences -> Maven -> User Settings. Point to a custom settings.xml.

    Within that settings.xml you can specify the location of the Maven repo as follows. This should also update M2_REPO variable.

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <settings>
      <localRepository>/Applications/rich-web-2.1.3/repository</localRepository>
      <offline>true</offline>
    </settings>
    HTH

    Christian
    Christian,

    Thanks for the tip.

    Henry

  5. #5
    Join Date
    Sep 2006
    Location
    Work in New York City
    Posts
    127

    Default file does not exist: /Users/rdg/.m2/settings.xml

    On a MacBook Pro running Snow Leopard am getting this error in STS 2.3.1 on a "clean package" operation (Run As ...Maven Build....)

    Code:
    The specified user settings file does not exist: /Users/rdg/.m2/settings.xml
    It's a brand new MacBook (my first Mac, I'm a Mac newbie). I thought maybe I could force creation of /Users/rdg/.m2/settings.xml by creating a new directory in a terminal window (outside of STS) and typing:
    Code:
    mvn archetype:generate  (etc)
    and creating a dummy maven project. I did that, and it put a lot of things into the local repository, but I can't figure out the location of the local repository where it put the jars.

    I don't see a ".m2" directory in Users/rdg. Maybe it's considered a hidden folder the way it is in Windows? Is there a way on a Mac to show folders and file that begin with "."?

    Wait... I just discovered the "." folders and files appear in a terminal window via the command "ls -lsa". So the problem is that "." folders and files do not appear in the Mac "finder". Anybody know a way to make "finder" show folders and files that begin with "." ? I will apparently need to create a settings.xml file myself in Users/rdg/.m2.
    I could see a case being made for the Spring STS install documentation to have more instructions on configuring maven on a MAC.

    Wait again... I just found a way to show the hidden files and folders in Finder. Simply go to a terminal window and type:

    Code:
    new-host:.m2 rdg$ defaults write com.apple.finder AppleShowAllFiles TRUE
    new-host:.m2 rdg$ killall Finder
    The solution, then, is simply to copy /usr/share/java/maven-2.2.0/conf/settings.xml into Users/rdg/.m2 :-)
    Last edited by RobertGloverJr; Mar 13th, 2010 at 07:20 PM.
    Java Developer with all the usual Sun Java certifications.

  6. #6

    Default

    Quote Originally Posted by RobertGloverJr View Post
    Code:
    new-host:.m2 rdg$ defaults write com.apple.finder AppleShowAllFiles TRUE
    new-host:.m2 rdg$ killall Finder
    Alternatively, if you like a nice GUI with a checkbox to "Show hidden and system files" then you can download the indispensable free app TinkerTool

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •