Return-Path: Delivered-To: apmail-maven-issues-archive@locus.apache.org Received: (qmail 83795 invoked from network); 22 Jun 2006 19:08:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Jun 2006 19:08:13 -0000 Received: (qmail 57477 invoked by uid 500); 22 Jun 2006 19:06:56 -0000 Delivered-To: apmail-maven-issues-archive@maven.apache.org Received: (qmail 56910 invoked by uid 500); 22 Jun 2006 19:06:53 -0000 Mailing-List: contact issues-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list issues@maven.apache.org Received: (qmail 56365 invoked by uid 99); 22 Jun 2006 18:57:03 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Jun 2006 11:57:03 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [63.246.20.114] (HELO 63-246-20-114.contegix.com) (63.246.20.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Jun 2006 11:57:02 -0700 Received: (qmail 14641 invoked by uid 89); 22 Jun 2006 18:56:41 -0000 Received: from unknown (HELO codehaus01.managed.contegix.com) (127.0.0.1) by smtp.domain.com with SMTP; 22 Jun 2006 18:56:41 -0000 Message-ID: <69645920.1151002601782.JavaMail.haus-jira@codehaus01.managed.contegix.com> Date: Thu, 22 Jun 2006 13:56:41 -0500 (CDT) From: "John Casey (JIRA)" To: issues@maven.apache.org Subject: [jira] Updated: (MNG-2200) [m2.0.3] Embedder - no way to override the "localRepository", .start() and alignWithUserInstallation broken In-Reply-To: <129582040.1144111544331.JavaMail.haus-jira@codehaus01.managed.contegix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://jira.codehaus.org/browse/MNG-2200?page=all ] John Casey updated MNG-2200: ---------------------------- Fix Version: 2.1 > [m2.0.3] Embedder - no way to override the "localRepository", .start() and alignWithUserInstallation broken > ----------------------------------------------------------------------------------------------------------- > > Key: MNG-2200 > URL: http://jira.codehaus.org/browse/MNG-2200 > Project: Maven 2 > Type: Bug > Components: Embedding > Versions: 2.0.3 > Environment: All > Reporter: Dan Rollo > Fix For: 2.1 > > > There is no way to override the "localRepository" used by MavenEmbedder. > Some code from MavenEmbedder.java: > public void setLocalRepositoryDirectory( File localRepositoryDirectory ) > { > this.localRepositoryDirectory = localRepositoryDirectory; > } > ... > public void start() > throws MavenEmbedderException > { > detectUserInstallation(); > ... > private void detectUserInstallation() > { > if ( new File( userHome, ".m2" ).exists() ) > { > alignWithUserInstallation = true; > } > } > /** > * Create the Settings that will be used with the embedder. If we are aligning with the user > * installation then we lookup the standard settings builder and use that to create our > * settings. Otherwise we constructs a settings object and populate the information > * ourselves. > * > * @throws MavenEmbedderException > * @throws ComponentLookupException > */ > private void createMavenSettings() > throws MavenEmbedderException, ComponentLookupException > { > if ( alignWithUserInstallation ) > { > // ---------------------------------------------------------------------- > // We will use the standard method for creating the settings. This > // method reproduces the method of building the settings from the CLI > // mode of operation. > // ---------------------------------------------------------------------- > settingsBuilder = (MavenSettingsBuilder) embedder.lookup( MavenSettingsBuilder.ROLE ); > ... > } > else > { > if ( localRepository == null ) > { > throw new IllegalArgumentException( "When not aligning with a user install you must specify a local repository location using the setLocalRepositoryDirectory( File ) method." ); > } > settings = new Settings(); > settings.setLocalRepository( localRepositoryDirectory.getAbsolutePath() ); > ... > The detectUserInstallation() method will never allow me to override the localRepository if an ".m2" user > directory exists (even if I call setAlignWithUserInstallation(false) and/or call setLocalRepositoryDirectory() before calling start() ). The current logic in the start() method always sets the field "alignWithUserInstallation" to true > if ".m2" exists. > Jason has confirmed this is a bug (on the maven user list), which he is working on, but on a major branch due to be merged at some point in the future. That said, I think this issue can easily be fixed quickly with the code change below applied to the method detectUserInstallation(): > private void detectUserInstallation() > { > if ( new File( userHome, ".m2" ).exists() ) > { > alignWithUserInstallation = true; > } > } > changed to (added another condition in the if): > private void detectUserInstallation() > { > if ( new File( userHome, ".m2" ).exists() && localRepositoryDirectory == null ) > { > alignWithUserInstallation = true; > } > } > If the next Embedder release will occur very soon and will include Jason's fixes, this bug is likely already fixed. However, if the merging of Jason's branch is a long way off, please consider fixing this bug for the next release. > thanks > Dan -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira