mirror of https://github.com/apache/maven.git
disperse constants only used in one place
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@164081 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bc738a21f4
commit
be6703f6da
|
@ -1,31 +0,0 @@
|
||||||
package org.apache.maven;
|
|
||||||
|
|
||||||
/* ====================================================================
|
|
||||||
* Copyright 2001-2004 The Apache Software Foundation.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class MavenConstants
|
|
||||||
{
|
|
||||||
public static final String MAVEN_MODEL_VERSION = "4.0.0";
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// Maven cli
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
public static final String MAVEN_USER_CONFIGURATION_DIRECTORY = ".m2";
|
|
||||||
|
|
||||||
public static final String MAVEN_REPOSITORY = "repository";
|
|
||||||
}
|
|
|
@ -16,10 +16,8 @@ package org.apache.maven.project;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.MavenConstants;
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.MavenMetadataSource;
|
import org.apache.maven.artifact.MavenMetadataSource;
|
||||||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
|
||||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
||||||
|
@ -99,6 +97,8 @@ public class DefaultMavenProjectBuilder
|
||||||
|
|
||||||
private final Map modelCache = new HashMap();
|
private final Map modelCache = new HashMap();
|
||||||
|
|
||||||
|
public static final String MAVEN_MODEL_VERSION = "4.0.0";
|
||||||
|
|
||||||
public void initialize()
|
public void initialize()
|
||||||
{
|
{
|
||||||
modelReader = new MavenXpp3Reader();
|
modelReader = new MavenXpp3Reader();
|
||||||
|
@ -554,7 +554,7 @@ public class DefaultMavenProjectBuilder
|
||||||
private Model getSuperModel()
|
private Model getSuperModel()
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
URL url = DefaultMavenProjectBuilder.class.getResource( "pom-" + MavenConstants.MAVEN_MODEL_VERSION + ".xml" );
|
URL url = DefaultMavenProjectBuilder.class.getResource( "pom-" + MAVEN_MODEL_VERSION + ".xml" );
|
||||||
|
|
||||||
return readModel( url );
|
return readModel( url );
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ package org.apache.maven.settings;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.MavenConstants;
|
|
||||||
import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
|
import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
|
||||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
||||||
|
@ -96,8 +95,7 @@ public class DefaultMavenSettingsBuilder
|
||||||
|
|
||||||
if ( settings.getActiveProfile() == null )
|
if ( settings.getActiveProfile() == null )
|
||||||
{
|
{
|
||||||
File mavenUserConfigurationDirectory = new File( userHome,
|
File mavenUserConfigurationDirectory = new File( userHome, ".m2" );
|
||||||
MavenConstants.MAVEN_USER_CONFIGURATION_DIRECTORY );
|
|
||||||
if ( !mavenUserConfigurationDirectory.exists() )
|
if ( !mavenUserConfigurationDirectory.exists() )
|
||||||
{
|
{
|
||||||
if ( !mavenUserConfigurationDirectory.mkdirs() )
|
if ( !mavenUserConfigurationDirectory.mkdirs() )
|
||||||
|
@ -106,7 +104,7 @@ public class DefaultMavenSettingsBuilder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String localRepository = new File( mavenUserConfigurationDirectory, MavenConstants.MAVEN_REPOSITORY ).getAbsolutePath();
|
String localRepository = new File( mavenUserConfigurationDirectory, "repository" ).getAbsolutePath();
|
||||||
|
|
||||||
settings.initializeActiveProfile( localRepository );
|
settings.initializeActiveProfile( localRepository );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue