The purpose of a corporate cache is to serve as a proxy to the real Maven repo.
Think of it like an Internet cache -- consider if you and I are working for the same company, and I visit www.cnn.com, and then 20 sec later you hit cnn.com. When I visit, our proxy server checks its cache, sees that it has no files related to cnn.com, and does a full HTTP request to get all the content etc. Then when you hit the site 20 sec later, our proxy server checks its cache, realizes it has cnn.com cached, and can serve you the files directly, without the extra time to retrieve the actual (unchanged) content from the cnn.com server. If you ask for msnbc.com however, it does not have those files, so it will need to do a full request. If you allow the individual web clients to access the content through alternate channels, you lose the power of the proxy. So you want to make sure ALL requests go through the proxy. The same is true for the corporate repo. You set up Artifactory (or Proximity etc) so it is the proxy for all Maven repo requests. When your client (the mvn executable)requests a file, say junit:junit:3.8, and the first time the cache doesn't have the file so it has to go retrieve it from Central etc. When my client tries to access the same file, the proxy says "hey, I have that file" and can serve it instantly. If you allow the individual Maven installations to access the files directly, without going through the corporate repo cache/proxy, then you lose the power of the proxy. If you do not override the "central" repo setting, then the local Maven installs will still know about the "real" Central, and they won't use your proxy for all requests which is what you want to configure, if you're setting up a corporate repo cache/proxy. Wayne On 8/20/07, Farhan Sarwar <[EMAIL PROTECTED]> wrote: > I am still not clear with the concept so if you could kindly elaborate > a bit further..i would appreciate it, to what i have understood so far > is that "central" and "snapshot" are the "ids" which maven uses to > determine if the public repository is to be overridden or not, but i > am just not clear as to how would maven behave differently given its > mirrored or overridden, isnt the concept is still the same, that is to > lookup the cache-repo first and if the artifact is not located lookup > the maven public repo. > > > Thanks in advance and Regards, > > Farhan. > > > > On 8/20/07, Yoav Landman <[EMAIL PROTECTED]> wrote: > > > > > 1) So if the ids is just the logical name inside maven , what > > > difference does it make if i name the Id as "central" or "snapshot" as > > > you suggested earlier, and i assume thats the only change you are > > > suggesting to my earlier configuration in the pom. > > > > > > > It matters to Maven if you wish to override Maven's built-in "central" and > > "snapshots" repositories (instead of using mirroring). > > > > > 2) Isn't that how it should be, given that if the artifact isn't found > > > in the local cache (which means that it wasnt refered/cached earlier > > > and hence the public repo should be looked up) > > > > It is how it should be and how it is inside Artifactory. What I was > > referring to is directly from your Maven client, which is normally not > > desired when having a corporate repository facade. > > > > > > > > On 8/20/07, Yoav Landman <[EMAIL PROTECTED]> wrote: > > > > > > > > 1) No. The id is just a logical name inside Maven. It is the URL that > > > > matters. If you use the http://localhost:8080/artifactory/repo you > point > > > at > > > > Artifactory's global virtual repository and an ordered search is > > > conducted > > > > on configured repositories, including caches, according to the > policies > > > set > > > > on each repository > > > > > (http://www.jfrog.org/sites/artifactory/latest/faqs.html#repositories). > > > > > > > > 2) Yes, it does work, but repo1 will still be consulted right after > > > > Artifactory (in case an artifact could not be resolved with the > current > > > > Artifactory configuration), which is normally not what you want. > > > > > > > > mfs wrote: > > > > > > > > > > Hi Yoav, > > > > > > > > > > It seems to be working now...Well actually the artifacts i was > > > > > refering to were actually the plugins (which were always being > > > > > downloaded from the maven public repo i.e. repo1), and after adding > > > > > the pluginrepositories section (as below) in pom those are now being > > > > > cached/downloaded from the locally configured repository...now your > > > > > last reply has got me a bit confused, 1) arent the ids suppose to be > > > > > whatever you have named them (in the key tag) in > > > > > artifactory.config.xml because thats from where you want to download > > > > > your artifact/plugin 2) why is it working like this.. > > > > > > > > > > <pluginRepositories> > > > > > <pluginRepository> > > > > > <id>maven-public-repo-cache</id> > > > > > <url>http://localhost:8080/artifactory/repo</url> > > > > > <snapshots> > > > > > <enabled>false</enabled> > > > > > </snapshots> > > > > > </pluginRepository> > > > > > </pluginRepositories> > > > > > > > > > > > > > > > > > > > > On 8/20/07, Yoav Landman <[EMAIL PROTECTED]> wrote: > > > > >> > > > > >> The repository id must be "central" to override repo1 (for > releases, > > > or > > > > >> "snapshots" to override it for snapshots). > > > > >> If you wish to use a different id, then you have to use mirroring > in > > > > >> settings.xml. > > > > >> > > > > >> HTH > > > > >> > > > > >> > > > > >> mfs wrote: > > > > >> > > > > > >> > Hi Yoav, > > > > >> > > > > > >> > Thanks for the quick follow..so basically among the two > approaches > > > > >> > suggested, the first is the one i have opted, and have defined > the > > > > >> > maven-public-repository-cache in the parent pom as it states > > > (instead > > > > >> > of settings.xml)..or am i still missing something.. > > > > >> > > > > > >> > Farhan. > > > > >> > > > > > >> > On 8/20/07, Yoav Landman <[EMAIL PROTECTED]> wrote: > > > > >> >> > > > > >> >> You need to make Artifactory either a mirror or a replacement > for > > > the > > > > >> >> "repo1" > > > > >> >> central repository by following a simple Maven configuration. > See: > > > > >> >> http://www.jfrog.org/sites/artifactory/latest/maven.html > > > > >> >> > > > > >> >> > > > > >> >> mfs wrote: > > > > >> >> > > > > > >> >> > Dear All, > > > > >> >> > > > > > >> >> > I have setup a maven public repository cache so as to maintain > > > the > > > > >> >> > artifacts used commonly (within the organization) and hence > not > > > > >> >> > require a download everytime from a maven public repository > and > > > btw > > > > >> i > > > > >> >> > am using Artifactory as the Repository Manager. > > > > >> >> > > > > > >> >> > So in order to achieve the above i have defined the following > in > > > the > > > > >> >> > artifactory-config.xml > > > > >> >> > > > > > >> >> > <remoteRepository> > > > > >> >> > <key>maven-public-repo</key> > > > > >> >> > <handleReleases>true</handleReleases> > > > > >> >> > <handleSnapshots>false</handleSnapshots> > > > > >> >> > > > > > >> <excludesPattern>org/artifactory/**,org/jfrog/**</excludesPattern> > > > > >> >> > <url>http://repo1.maven.org/maven2</url> > > > > >> >> > </remoteRepository> > > > > >> >> > > > > > >> >> > and similarly in the pom.xml i have defined the following > entry > > > so > > > > >> as > > > > >> >> > to refer to it.. > > > > >> >> > > > > > >> >> > <repository> > > > > >> >> > <id>maven-public-repo-cache</id> > > > > >> >> > <name>xyz Repository</name> > > > > >> >> > <url>http://localhost:8080/artifactory/repo</url> > > > > >> >> > <layout>default</layout> > > > > >> >> > <releases> > > > > >> >> > <enabled>true</enabled> > > > > >> >> > </releases> > > > > >> >> > <snapshots> > > > > >> >> > <enabled>false</enabled> > > > > >> >> > </snapshots> > > > > >> >> > </repository> > > > > >> >> > > > > > >> >> > Now the problem is that the repository DOES cache artifacts > but > > > NOT > > > > >> >> > all of the artifacts that are downloaded (from the public > repo) > > > and > > > > >> >> > hence for them it still refers to the repo1.maven.org, now i > am > > > not > > > > >> >> > sure why is that the case..why is it not caching everything ? > > > > >> >> > > > > > >> >> > Thanks in advance and Regards, > > > > >> >> > > > > > >> >> > Farhan. > > > > >> >> > > > > > >> >> > > > > > >> > --------------------------------------------------------------------- > > > > >> >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > >> >> > For additional commands, e-mail: [EMAIL PROTECTED] > > > > >> >> > > > > > >> >> > > > > > >> >> > > > > > >> >> > > > > >> >> -- > > > > >> >> View this message in context: > > > > >> >> > > > > >> > > > > http://www.nabble.com/artifactory---maintaining-a-public-repo-cache-tf4301698s177.html#a12245037 > > > > >> >> Sent from the Maven - Users mailing list archive at Nabble.com. > > > > >> >> > > > > >> >> > > > > >> >> > > > --------------------------------------------------------------------- > > > > >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > >> >> For additional commands, e-mail: [EMAIL PROTECTED] > > > > >> >> > > > > >> >> > > > > >> > > > > > >> > > > > --------------------------------------------------------------------- > > > > >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > >> > For additional commands, e-mail: [EMAIL PROTECTED] > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > >> -- > > > > >> View this message in context: > > > > >> > > > > http://www.nabble.com/artifactory---maintaining-a-public-repo-cache-tf4301698s177.html#a12245254 > > > > >> Sent from the Maven - Users mailing list archive at Nabble.com. > > > > >> > > > > >> > > > > >> > --------------------------------------------------------------------- > > > > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > >> For additional commands, e-mail: [EMAIL PROTECTED] > > > > >> > > > > >> > > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > -- > > > > View this message in context: > > > > http://www.nabble.com/artifactory---maintaining-a-public-repo-cache-tf4301698s177.html#a12245584 > > > > Sent from the Maven - Users mailing list archive at Nabble.com. > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > -- > > View this message in context: > http://www.nabble.com/artifactory---maintaining-a-public-repo-cache-tf4301698s177.html#a12245917 > > Sent from the Maven - Users mailing list archive at Nabble.com. > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
