>-----Original Message-----
>From: Trevor Harmon [mailto:tre...@vocaro.com]
>On Aug 16, 2010, at 1:20 AM, Stephen Connolly wrote:
>> Your life would be much easier using a repository manager for your
>> "internal" repository.  Nexus is almost trivial to set up, for
example.
>
>It is trivial to set up *if* you have the necessary permissions to set
up
>the service. In my case, I'm an independent contractor, and the only
server
>I personally have access to is from one of those shared hosting
providers,
>and it's simply not possible to run Jetty or Tanuki in that kind of
>environment. My client does have their own servers, but I'd have to
make a
>special request to get one of their IT guys to set it up for me. So
unless
>you've got root access to your own server... not trivial.

I'm not sure whether this helps you any, but you don't need to run Nexus
as root.  For instance, I run it under it's own userid, on a
greater-than-1024 port that was arbitrarily chosen when we installed it.

>Okay, but I'm just not understanding how to configure Maven for that.
Sure,
>I could set up a <repositories> element like this:
>
><repositories>
>    <repository>
>        <id>central</id>
>        <url>http://repo.myserver.com/repository/</url>
>    </repository>
></repositories>

Not quite.  You're probably going to want everything going through the
repository manager.  I ended up modifying the settings.xml file across
all the machines that I have maven installed.  That is probably better
handled through a ~/.m2/settings.xml file, but it works about the same.
The things I added are:

A mirror element, which forces all requests to go through nexus:
  <mirror>
        <!--This sends everything else to /public -->
        <id>nexus</id>
        <mirrorOf>*</mirrorOf>
 
<url>http://repo.mysever.com:5678/nexus/content/groups/public</url>
  </mirror>  

That "/nexus/content/groups/public" path maps to a "repository group"
that I setup in nexus.  Each actual repository on the net (such as
central) are created in nexus as proxy repositories, then added to the
repository group.

A profile element that lists an arbitrary repository:
   <profile>
           <id>nexus</id>
           <repositories>
                   <repository>
                           <id>central</id>
                           <url>http://central</url>
                           <releases><enabled>true</enabled></releases>
 
<snapshots><enabled>true</enabled></snapshots>
                   </repository>
           </repositories>
           <pluginRepositories>
                   <pluginRepository>
...same as repository element...
                   </pluginRepository>
           </pluginRepositories>
   </profile>
   <activeProfiles>
       <activeProfile>nexus</activeProfile> <!-- always active -->
   </activeProfiles>

A server element with the username and password for deploying things:
<server>
   <id>nexus</id>
   <username>...</username>
   <password>...</password>
</server>

>And that tells Maven to check the above URL for artifacts before going
out
>to repo1.maven.org. But it only knows how to download, not upload. How
can
>Maven put the newly downloaded artifacts into this repository? (I
thought
>that's what a repository manager is for...)

Uploading happens through the distributionManagment url you put in your
pom.xml file (or possibly a common, shared parent pom file).  e.g.:

<project>
      ...other pom.xml stuff...

        <distributionManagement>
                <repository>
                        <id>nexus</id>
                        <uniqueVersion>false</uniqueVersion>
                        <name>Releases</name>
        
<url>http://repo.myserver.com:5678/nexus/content/repositories/releases/<
/url>
                </repository>

        <!-- 
                When a build has a version of <foo>-SNAPSHOT, this
repository
                will be used for the "deploy" phase.
         -->
        <snapshotRepository>
                <id>nexus</id>
                <uniqueVersion>true</uniqueVersion>
                <name>Snapshots</name>
        
<url>http://repo.myserver.com:5678/nexus/content/repositories/snapshots/
</url>
        </snapshotRepository>

        </distributionManagement>
</project>

The "/nexus/content/repositories/snapshot" and .../releases paths are
"hosted" repositories that were created within Nexus.

Hope this helps.

eric

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to