You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by JesseLiu <je...@ecvision.com> on 2007/03/15 02:55:36 UTC
How to Use custom central repository completely instead of the default central repository?
I want to build a file repository in my computer which can't access Internet.
so, I create the repository in file://e:\repository1 which contains all the required artifacts hierarchy. and config pom.xml like below:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.dolly</groupId>
<artifactId>sample</artifactId>
<version>1.0.1</version>
<dependencies/>
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url> file://e:\repository1 </url>
</repository>
</repositories>
</project>
The localRepository of Maven2 is default to ~/.m2/ which has no artifacts at the beginning. The mvn result is :
E:\mvndemo\my-app>mvn -o compile
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-resources-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
According log, mvn2 try to access http://repo1.maven.org/maven2 ( not file://e:\repository1 ) to download the maven-resources-plugin.
How can my own repository completely replace the dafault repository http://repo1.maven.org/maven2.
Thanks for any suggestion?
RE: How to Use custom central repository completely instead of the default central repository?
Posted by Peter Anning <PA...@dialectpayments.com>.
You need to define it in your settings.xml as a mirror in your
settings.xml and place a repository in an active profile as per the
example below (note the three slashes in the file url:
<settings>
...
<mirrors>
<mirror>
<id>mirror-maven-central</id>
<mirrorOf>central</mirrorOf>
<name>Local Override for The Maven Central Repository</name>
<url>file:///E:\repository1\</url> <!-- Yes this works it's how
you define a file based repo -->
</mirror>
</mirrors>
...
<profile>
<id>myProfile</id>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy/>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy/>
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
<id>my-central</id>
<name>Maven Repository
Switchboard</name>
<url>file:///E:\repository1\</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>my-central</id>
<name>Maven Plugin Repository</name>
<url>file:///E:\repository1\</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>myProfile</activeProfile>
</activeProfiles>
</settings
> -----Original Message-----
> From: JesseLiu [mailto:jesseliu@ecvision.com]
> Sent: Thursday, 15 March 2007 11:56 AM
> To: Maven Users List
> Subject: How to Use custom central repository completely
> instead of the default central repository?
>
>
> I want to build a file repository in my computer which can't
> access Internet. so, I create the repository in
> file://e:\repository1 which contains all the required
> artifacts hierarchy. and config pom.xml like below: <project>
> <modelVersion>4.0.0</modelVersion>
> <groupId>com.mycompany.dolly</groupId>
> <artifactId>sample</artifactId>
> <version>1.0.1</version>
> <dependencies/>
> <repositories>
> <repository>
> <id>central</id>
> <name>Maven Repository Switchboard</name>
> <layout>default</layout>
> <url> file://e:\repository1 </url>
> </repository>
> </repositories>
> </project>
>
> The localRepository of Maven2 is default to ~/.m2/ which has
> no artifacts at the beginning. The mvn result is :
> E:\mvndemo\my-app>mvn -o compile [ERROR] BUILD ERROR [INFO]
> --------------------------------------------------------------
> ----------
> [INFO] The plugin
> 'org.apache.maven.plugins:maven-resources-plugin' does not
> exist or no valid version could be found [INFO]
> --------------------------------------------------------------
> ----------
>
> According log, mvn2 try to access
> http://repo1.maven.org/maven2 ( not file://e:\repository1 )
> to download the maven-resources-plugin.
> How can my own repository completely replace the dafault
> repository http://repo1.maven.org/maven2.
>
> Thanks for any suggestion?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org