Announcement Announcement Module
Collapse
No announcement yet.
How to modify M2_REPO? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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

      Comment


      • #4
        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

        Comment


        • #5
          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, 07:20 PM.

          Comment


          • #6
            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

            Comment

            Working...
            X