You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jd...@apache.org on 2005/05/31 18:24:37 UTC
svn commit: r179233 - /maven/components/trunk/maven-core
/maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it
/maven/components/trunk/maven-core/src/main/java/org/apache/maven
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/model
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/settings
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings
/maven/components/trunk/maven-core/src/main/resources/META-INF/plexus
/maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin
/maven/components/trunk/maven-mboot2/src/main/java
/maven/components/trunk/maven-model /maven/components/trunk/maven-profile
/maven/components/trunk/maven-settings
Author: jdcasey
Date: Tue May 31 09:24:34 2005
New Revision: 179233
URL: http://svn.apache.org/viewcvs?rev=179233&view=rev
Log:
o Added model and builder support for Profiles specified in settings.xml, profiles.xml, and the POM.
o Changed MBoot and Verifier accordingly.
Added:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/
maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/
- copied from r169038, maven/components/trunk/maven-core/src/main/java/org/apache/maven/util/
maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/DefaultMavenProfilesBuilder.java (with props)
maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/MavenProfilesBuilder.java (with props)
maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/ModelNormalizationUtils.java (with props)
maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/settings/
- copied from r169038, maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/
maven/components/trunk/maven-profile/
maven/components/trunk/maven-profile/pom.xml (with props)
maven/components/trunk/maven-profile/profiles.mdo (with props)
Removed:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java
Modified:
maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java
maven/components/trunk/maven-core/pom.xml
maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/settings/DefaultMavenSettingsBuilder.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/settings/MavenSettingsBuilder.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
maven/components/trunk/maven-mboot2/src/main/java/MBoot.java
maven/components/trunk/maven-model/maven.mdo
maven/components/trunk/maven-settings/settings.mdo
Modified: maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java (original)
+++ maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java Tue May 31 09:24:34 2005
@@ -3,7 +3,6 @@
import org.apache.maven.it.cli.CommandLineUtils;
import org.apache.maven.it.cli.Commandline;
import org.apache.maven.it.cli.StreamConsumer;
-import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@@ -11,6 +10,7 @@
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -347,10 +347,8 @@
if ( userXml.exists() )
{
userModelReader.parse( userXml );
-
- Profile activeProfile = userModelReader.getActiveMavenProfile();
-
- repo = new File( activeProfile.getLocalRepo() ).getAbsolutePath();
+
+ repo = new File( userModelReader.getLocalRepository() ).getAbsolutePath();
}
}
catch ( Exception e )
@@ -583,7 +581,9 @@
verifier.displayStreamBuffers();
- e.printStackTrace();
+ System.out.println(">>>>>> Error Stacktrace:");
+ e.printStackTrace(System.out);
+ System.out.println("<<<<<< Error Stacktrace");
verifier.displayLogFile();
@@ -599,15 +599,11 @@
{
private SAXParserFactory saxFactory;
-
- private List profiles = new ArrayList();
-
- private Profile currentProfile = null;
+
+ private String localRepository;
private StringBuffer currentBody = new StringBuffer();
- private Profile activeMavenProfile = null;
-
public boolean parse( File file )
{
try
@@ -651,9 +647,9 @@
spe.getMessage() );
}
- public Profile getActiveMavenProfile()
+ public String getLocalRepository()
{
- return activeMavenProfile;
+ return localRepository;
}
public void characters( char[] ch, int start, int length )
@@ -665,12 +661,11 @@
public void endElement( String uri, String localName, String rawName )
throws SAXException
{
- if ( "profile".equals( rawName ) )
+ if ( "localRepository".equals( rawName ) )
{
- if ( notEmpty( currentProfile.getLocalRepo() ) )
+ if ( notEmpty( currentBody.toString() ) )
{
- profiles.add( currentProfile );
- currentProfile = null;
+ localRepository = currentBody.toString().trim();
}
else
{
@@ -678,39 +673,6 @@
"fields: {localRepository}." );
}
}
- else if ( currentProfile != null )
- {
- if ( "active".equals( rawName ) )
- {
- currentProfile.setActive( Boolean.valueOf( currentBody.toString().trim() ).booleanValue() );
- }
- else if ( "localRepository".equals( rawName ) )
- {
- currentProfile.setLocalRepo( currentBody.toString().trim() );
- }
- else
- {
- throw new SAXException( "Illegal element inside profile: \'" + rawName + "\'" );
- }
- }
- else if ( "settings".equals( rawName ) )
- {
- if ( profiles.size() == 1 )
- {
- activeMavenProfile = (Profile) profiles.get( 0 );
- }
- else
- {
- for ( Iterator it = profiles.iterator(); it.hasNext(); )
- {
- Profile profile = (Profile) it.next();
- if ( profile.isActive() )
- {
- activeMavenProfile = profile;
- }
- }
- }
- }
currentBody = new StringBuffer();
}
@@ -720,51 +682,11 @@
return test != null && test.trim().length() > 0;
}
- public void startElement( String uri, String localName, String rawName, Attributes attributes )
- throws SAXException
- {
- if ( "profile".equals( rawName ) )
- {
- currentProfile = new Profile();
- }
- }
-
public void reset()
{
this.currentBody = null;
- this.activeMavenProfile = null;
- this.currentProfile = null;
- this.profiles.clear();
+ this.localRepository = null;
}
- }
-
- public static class Profile
- {
-
- private String localRepository;
-
- private boolean active = false;
-
- public void setLocalRepo( String localRepo )
- {
- this.localRepository = localRepo;
- }
-
- public String getLocalRepo()
- {
- return localRepository;
- }
-
- public void setActive( boolean active )
- {
- this.active = active;
- }
-
- public boolean isActive()
- {
- return active;
- }
-
}
}
Modified: maven/components/trunk/maven-core/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/pom.xml?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core/pom.xml (original)
+++ maven/components/trunk/maven-core/pom.xml Tue May 31 09:24:34 2005
@@ -41,6 +41,11 @@
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
+ <artifactId>maven-profile</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Tue May 31 09:24:34 2005
@@ -24,6 +24,10 @@
import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.LifecycleExecutionException;
import org.apache.maven.lifecycle.LifecycleExecutor;
+import org.apache.maven.model.settings.Mirror;
+import org.apache.maven.model.settings.Proxy;
+import org.apache.maven.model.settings.Server;
+import org.apache.maven.model.settings.Settings;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.MavenEvents;
import org.apache.maven.plugin.MojoExecutionException;
@@ -32,10 +36,6 @@
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.ProjectSorter;
import org.apache.maven.reactor.ReactorException;
-import org.apache.maven.settings.Mirror;
-import org.apache.maven.settings.Proxy;
-import org.apache.maven.settings.Server;
-import org.apache.maven.settings.Settings;
import org.apache.maven.usability.ErrorDiagnoser;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
@@ -85,7 +85,7 @@
public MavenExecutionResponse execute( MavenExecutionRequest request )
throws ReactorException
{
- if ( request.getSettings().getActiveProfile().isOffline() )
+ if ( request.getSettings().isOffline() )
{
getLogger().info( "Maven is running in offline mode." );
}
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java Tue May 31 09:24:34 2005
@@ -33,13 +33,13 @@
import org.apache.maven.execution.MavenExecutionResponse;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.model.settings.MavenSettingsBuilder;
+import org.apache.maven.model.settings.Settings;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.monitor.event.DefaultEventMonitor;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.plugin.Mojo;
import org.apache.maven.reactor.ReactorException;
-import org.apache.maven.settings.MavenSettingsBuilder;
-import org.apache.maven.settings.Settings;
import org.codehaus.classworlds.ClassWorld;
import org.codehaus.plexus.PlexusContainerException;
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
@@ -352,13 +352,13 @@
ArtifactRepositoryFactory artifactRepositoryFactory = (ArtifactRepositoryFactory) embedder.lookup(
ArtifactRepositoryFactory.ROLE );
- String url = "file://" + settings.getActiveProfile().getLocalRepository();
+ String url = "file://" + settings.getLocalRepository();
ArtifactRepository localRepository = new ArtifactRepository( "local", url, repositoryLayout );
boolean snapshotPolicySet = false;
if ( commandLine.hasOption( CLIManager.OFFLINE ) )
{
- settings.getActiveProfile().setOffline( true );
+ settings.setOffline( true );
// TODO: this will still check to download if the artifact does not exist locally, instead of failing as it should in offline mode
artifactRepositoryFactory.setGlobalSnapshotPolicy( ArtifactRepository.SNAPSHOT_POLICY_NEVER );
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java Tue May 31 09:24:34 2005
@@ -17,9 +17,9 @@
*/
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.settings.Settings;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.EventMonitor;
-import org.apache.maven.settings.Settings;
import java.util.List;
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java Tue May 31 09:24:34 2005
@@ -17,9 +17,9 @@
*/
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.settings.Settings;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.EventMonitor;
-import org.apache.maven.settings.Settings;
import java.util.List;
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java Tue May 31 09:24:34 2005
@@ -17,9 +17,9 @@
*/
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.settings.Settings;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.project.MavenProject;
-import org.apache.maven.settings.Settings;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.context.Context;
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Tue May 31 09:24:34 2005
@@ -25,6 +25,7 @@
import org.apache.maven.model.Goal;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.settings.Settings;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.PluginManager;
import org.apache.maven.plugin.PluginManagerException;
@@ -33,7 +34,6 @@
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.injection.ModelDefaultsInjector;
-import org.apache.maven.settings.Settings;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import java.util.ArrayList;
@@ -290,7 +290,7 @@
private void configureMojoPhaseBinding( MojoDescriptor mojoDescriptor, Map phaseMap, Settings settings )
throws LifecycleExecutionException
{
- if ( settings.getActiveProfile().isOffline() && mojoDescriptor.isOnlineRequired() )
+ if ( settings.isOffline() && mojoDescriptor.isOnlineRequired() )
{
String goal = mojoDescriptor.getGoal();
getLogger().warn( goal + " requires online mode, but maven is currently offline. Disabling " + goal + "." );
Added: maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/DefaultMavenProfilesBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/DefaultMavenProfilesBuilder.java?rev=179233&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/DefaultMavenProfilesBuilder.java (added)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/DefaultMavenProfilesBuilder.java Tue May 31 09:24:34 2005
@@ -0,0 +1,59 @@
+package org.apache.maven.model.profiles;
+
+import org.apache.maven.model.profiles.io.xpp3.ProfilesXpp3Reader;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+/*
+ * Copyright 2001-2005 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 DefaultMavenProfilesBuilder
+ implements MavenProfilesBuilder
+{
+
+ private static final String PROFILES_XML_FILE = "profiles.xml";
+
+ public ProfilesRoot buildProfiles( File basedir )
+ throws IOException, XmlPullParserException
+ {
+ File profilesXml = new File( basedir, PROFILES_XML_FILE );
+
+ ProfilesRoot profilesRoot = null;
+
+ if( profilesXml.exists() )
+ {
+ ProfilesXpp3Reader reader = new ProfilesXpp3Reader();
+ FileReader fileReader = null;
+ try
+ {
+ fileReader = new FileReader( profilesXml );
+
+ profilesRoot = reader.read( fileReader );
+ }
+ finally
+ {
+ IOUtil.close( fileReader );
+ }
+ }
+
+ return profilesRoot;
+ }
+
+}
Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/DefaultMavenProfilesBuilder.java
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author"
Added: maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/MavenProfilesBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/MavenProfilesBuilder.java?rev=179233&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/MavenProfilesBuilder.java (added)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/MavenProfilesBuilder.java Tue May 31 09:24:34 2005
@@ -0,0 +1,34 @@
+package org.apache.maven.model.profiles;
+
+/*
+ * Copyright 2001-2005 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.
+ */
+
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * @author jdcasey
+ * @version $Id: MavenProfilesBuilder.java 168292 2005-05-05 07:16:07Z brett $
+ */
+public interface MavenProfilesBuilder
+{
+ String ROLE = MavenProfilesBuilder.class.getName();
+
+ ProfilesRoot buildProfiles( File basedir )
+ throws IOException, XmlPullParserException;
+}
Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/MavenProfilesBuilder.java
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author"
Added: maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/ModelNormalizationUtils.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/ModelNormalizationUtils.java?rev=179233&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/ModelNormalizationUtils.java (added)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/ModelNormalizationUtils.java Tue May 31 09:24:34 2005
@@ -0,0 +1,110 @@
+package org.apache.maven.model.profiles;
+
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.Repository;
+
+import java.util.Iterator;
+import java.util.List;
+
+/*
+ * Copyright 2001-2005 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 final class ModelNormalizationUtils
+{
+
+ private ModelNormalizationUtils()
+ {
+ }
+
+ public static Profile convertFromSettingsProfile( org.apache.maven.model.settings.Profile settingsProfile )
+ {
+ Profile profile = new Profile();
+ profile.setConfiguration( settingsProfile.getConfiguration() );
+
+ List repos = settingsProfile.getRepositories();
+ if( repos != null )
+ {
+ for ( Iterator it = repos.iterator(); it.hasNext(); )
+ {
+ profile.addRepository( convertFromSettingsRepository( (org.apache.maven.model.settings.Repository) it.next() ) );
+ }
+ }
+
+ List pluginRepos = settingsProfile.getPluginRepositories();
+ if( pluginRepos != null )
+ {
+ for ( Iterator it = pluginRepos.iterator(); it.hasNext(); )
+ {
+ profile.addPluginRepository( convertFromSettingsRepository( (org.apache.maven.model.settings.Repository) it.next() ) );
+ }
+ }
+
+ return profile;
+ }
+
+ public static Profile convertFromProfileXmlProfile( org.apache.maven.model.profiles.Profile profileXmlProfile )
+ {
+ Profile profile = new Profile();
+ profile.setConfiguration( profileXmlProfile.getConfiguration() );
+
+ List repos = profileXmlProfile.getRepositories();
+ if( repos != null )
+ {
+ for ( Iterator it = repos.iterator(); it.hasNext(); )
+ {
+ profile.addRepository( convertFromSettingsRepository( (org.apache.maven.model.settings.Repository) it.next() ) );
+ }
+ }
+
+ List pluginRepos = profileXmlProfile.getPluginRepositories();
+ if( pluginRepos != null )
+ {
+ for ( Iterator it = pluginRepos.iterator(); it.hasNext(); )
+ {
+ profile.addPluginRepository( convertFromSettingsRepository( (org.apache.maven.model.settings.Repository) it.next() ) );
+ }
+ }
+
+ return profile;
+ }
+
+ private static Repository convertFromSettingsRepository( org.apache.maven.model.settings.Repository settingsRepo )
+ {
+ Repository repo = new Repository();
+
+ repo.setId( settingsRepo.getId() );
+ repo.setLayout( settingsRepo.getLayout() );
+ repo.setName( settingsRepo.getName() );
+ repo.setSnapshotPolicy( settingsRepo.getSnapshotPolicy() );
+ repo.setUrl( settingsRepo.getUrl() );
+
+ return repo;
+ }
+
+ private static Repository convertFromProfileXmlRepository( org.apache.maven.model.profiles.Repository profileXmlRepo )
+ {
+ Repository repo = new Repository();
+
+ repo.setId( profileXmlRepo.getId() );
+ repo.setLayout( profileXmlRepo.getLayout() );
+ repo.setName( profileXmlRepo.getName() );
+ repo.setSnapshotPolicy( profileXmlRepo.getSnapshotPolicy() );
+ repo.setUrl( profileXmlRepo.getUrl() );
+
+ return repo;
+ }
+
+}
Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/profiles/ModelNormalizationUtils.java
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author"
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/settings/DefaultMavenSettingsBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/settings/DefaultMavenSettingsBuilder.java?rev=179233&r1=169038&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/settings/DefaultMavenSettingsBuilder.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/settings/DefaultMavenSettingsBuilder.java Tue May 31 09:24:34 2005
@@ -1,4 +1,4 @@
-package org.apache.maven.settings;
+package org.apache.maven.model.settings;
/*
* Copyright 2001-2005 The Apache Software Foundation.
@@ -16,7 +16,8 @@
* limitations under the License.
*/
-import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
+import org.apache.maven.model.settings.Settings;
+import org.apache.maven.model.settings.io.xpp3.SettingsXpp3Reader;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.util.IOUtil;
@@ -56,7 +57,7 @@
}
// ----------------------------------------------------------------------
- // MavenSettingsBuilder Implementation
+ // MavenProfilesBuilder Implementation
// ----------------------------------------------------------------------
public Settings buildSettings()
@@ -92,8 +93,8 @@
settings = new Settings();
}
-
- if ( settings.getActiveProfile() == null )
+
+ if( settings.getLocalRepository() == null || settings.getLocalRepository().length() < 1 )
{
File mavenUserConfigurationDirectory = new File( userHome, ".m2" );
if ( !mavenUserConfigurationDirectory.exists() )
@@ -105,8 +106,8 @@
}
String localRepository = new File( mavenUserConfigurationDirectory, "repository" ).getAbsolutePath();
-
- settings.initializeActiveProfile( localRepository );
+
+ settings.setLocalRepository( localRepository );
}
return settings;
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/settings/MavenSettingsBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/settings/MavenSettingsBuilder.java?rev=179233&r1=169038&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/settings/MavenSettingsBuilder.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/settings/MavenSettingsBuilder.java Tue May 31 09:24:34 2005
@@ -1,4 +1,4 @@
-package org.apache.maven.settings;
+package org.apache.maven.model.settings;
/*
* Copyright 2001-2005 The Apache Software Foundation.
@@ -16,6 +16,7 @@
* limitations under the License.
*/
+import org.apache.maven.model.settings.Settings;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.IOException;
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Tue May 31 09:24:34 2005
@@ -815,7 +815,7 @@
ArtifactFilter filter = new ScopeArtifactFilter( scope );
- boolean systemOnline = !context.getSettings().getActiveProfile().isOffline();
+ boolean systemOnline = !context.getSettings().isOffline();
ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getArtifacts(),
context.getRemoteRepositories(),
Modified: maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml Tue May 31 09:24:34 2005
@@ -154,8 +154,8 @@
</component>
<component>
- <role>org.apache.maven.settings.MavenSettingsBuilder</role>
- <implementation>org.apache.maven.settings.DefaultMavenSettingsBuilder</implementation>
+ <role>org.apache.maven.model.settings.MavenSettingsBuilder</role>
+ <implementation>org.apache.maven.model.settings.DefaultMavenSettingsBuilder</implementation>
<configuration>
<settingsPath>${user.home}/.m2/settings.xml</settingsPath>
</configuration>
Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java Tue May 31 09:24:34 2005
@@ -21,9 +21,9 @@
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
+import org.apache.maven.model.settings.Settings;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.project.MavenProject;
-import org.apache.maven.settings.Settings;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
Modified: maven/components/trunk/maven-mboot2/src/main/java/MBoot.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-mboot2/src/main/java/MBoot.java?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-mboot2/src/main/java/MBoot.java (original)
+++ maven/components/trunk/maven-mboot2/src/main/java/MBoot.java Tue May 31 09:24:34 2005
@@ -35,7 +35,7 @@
public class MBoot
{
- String[] builds = new String[]{"maven-model", "maven-settings", "maven-monitor", "maven-plugin-api",
+ String[] builds = new String[]{"maven-model", "maven-settings", "maven-profile", "maven-monitor", "maven-plugin-api",
"maven-plugin-descriptor", "maven-artifact", "maven-script/maven-script-marmalade",
"maven-script/maven-script-beanshell", "maven-project",
"maven-reporting/maven-reporting-api", "maven-core", "maven-archiver",
@@ -59,12 +59,14 @@
Map targetVersions = new TreeMap();
targetVersions.put( "maven-model", "4.0.0" );
targetVersions.put( "maven-settings", "1.0.0" );
+ targetVersions.put( "maven-profile", "1.0.0" );
MODELLO_TARGET_VERSIONS = Collections.unmodifiableMap( targetVersions );
Map modelFiles = new TreeMap();
modelFiles.put( "maven-model", "maven.mdo" );
modelFiles.put( "maven-settings", "settings.mdo" );
+ modelFiles.put( "maven-profile", "profiles.mdo" );
MODELLO_MODEL_FILES = Collections.unmodifiableMap( modelFiles );
}
@@ -152,12 +154,7 @@
{
userModelReader.parse( settingsXml );
- Profile activeProfile = userModelReader.getActiveProfile();
-
- if ( mavenRepoLocal == null && activeProfile != null )
- {
- mavenRepoLocal = new File( activeProfile.getLocalRepo() ).getAbsolutePath();
- }
+ mavenRepoLocal = userModelReader.getLocalRepository();
}
if ( mavenRepoLocal == null )
@@ -177,12 +174,7 @@
System.out.println();
System.out.println( "<settings>" );
- System.out.println( " <profiles>" );
- System.out.println( " <profile>" );
- System.out.println( " <active>true</active>" );
- System.out.println( " <localRepository>/path/to/your/repository</localRepository>" );
- System.out.println( " </profile>" );
- System.out.println( " </profiles>" );
+ System.out.println( " <localRepository>/path/to/your/repository</localRepository>" );
System.out.println( "</settings>" );
System.out.println();
@@ -974,25 +966,21 @@
{
private List mirrors = new ArrayList();
- private List profiles = new ArrayList();
-
- private Profile currentProfile = null;
-
private List proxies = new ArrayList();
private Proxy currentProxy = null;
private StringBuffer currentBody = new StringBuffer();
- private Profile activeProfile = null;
-
private Proxy activeProxy = null;
private Mirror currentMirror;
-
- public Profile getActiveProfile()
+
+ private String localRepository;
+
+ public String getLocalRepository()
{
- return activeProfile;
+ return localRepository;
}
public Proxy getActiveProxy()
@@ -1009,12 +997,11 @@
public void endElement( String uri, String localName, String rawName )
throws SAXException
{
- if ( "profile".equals( rawName ) )
+ if ( "localRepository".equals( rawName ) )
{
- if ( notEmpty( currentProfile.getLocalRepo() ) )
+ if ( notEmpty( currentBody.toString() ) )
{
- profiles.add( currentProfile );
- currentProfile = null;
+ localRepository = currentBody.toString().trim();
}
else
{
@@ -1022,21 +1009,6 @@
"fields: {localRepository}." );
}
}
- else if ( currentProfile != null )
- {
- if ( "active".equals( rawName ) )
- {
- currentProfile.setActive( Boolean.valueOf( currentBody.toString().trim() ).booleanValue() );
- }
- else if ( "localRepository".equals( rawName ) )
- {
- currentProfile.setLocalRepo( currentBody.toString().trim() );
- }
- else
- {
- throw new SAXException( "Illegal element inside profile: \'" + rawName + "\'" );
- }
- }
else if ( "proxy".equals( rawName ) )
{
if ( notEmpty( currentProxy.getHost() ) && notEmpty( currentProxy.getPort() ) )
@@ -1119,21 +1091,6 @@
}
else if ( "settings".equals( rawName ) )
{
- if ( profiles.size() == 1 )
- {
- activeProfile = (Profile) profiles.get( 0 );
- }
- else
- {
- for ( Iterator it = profiles.iterator(); it.hasNext(); )
- {
- Profile profile = (Profile) it.next();
- if ( profile.isActive() )
- {
- activeProfile = profile;
- }
- }
- }
if ( proxies.size() != 0 )
{
for ( Iterator it = proxies.iterator(); it.hasNext(); )
@@ -1158,11 +1115,7 @@
public void startElement( String uri, String localName, String rawName, Attributes attributes )
throws SAXException
{
- if ( "profile".equals( rawName ) )
- {
- currentProfile = new Profile();
- }
- else if ( "proxy".equals( rawName ) )
+ if ( "proxy".equals( rawName ) )
{
currentProxy = new Proxy();
}
@@ -1175,11 +1128,9 @@
public void reset()
{
this.currentBody = null;
- this.activeProfile = null;
this.activeProxy = null;
- this.currentProfile = null;
this.currentMirror = null;
- this.profiles.clear();
+ this.localRepository = null;
this.proxies.clear();
this.mirrors.clear();
}
@@ -1187,33 +1138,6 @@
public List getMirrors()
{
return mirrors;
- }
- }
-
- public static class Profile
- {
- private String localRepo;
-
- private boolean active = false;
-
- public void setLocalRepo( String localRepo )
- {
- this.localRepo = localRepo;
- }
-
- public boolean isActive()
- {
- return active;
- }
-
- public void setActive( boolean active )
- {
- this.active = active;
- }
-
- public String getLocalRepo()
- {
- return localRepo;
}
}
Modified: maven/components/trunk/maven-model/maven.mdo
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-model/maven.mdo?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-model/maven.mdo (original)
+++ maven/components/trunk/maven-model/maven.mdo Tue May 31 09:24:34 2005
@@ -584,6 +584,17 @@
when generating <a href="/plugins/javadoc/index.html">JavaDoc</a>.
]]></description>
</field>
+ <field>
+ <name>profiles</name>
+ <version>4.0.0</version>
+ <description><![CDATA[
+ Listing of project-local build profiles which will modify the build process when activated.
+ ]]></description>
+ <association>
+ <type>Profile</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
</fields>
<codeSegments>
<codeSegment>
@@ -707,10 +718,34 @@
</codeSegments>
</class>
<class>
- <name>Build</name>
+ <name>PluginConfiguration</name>
<version>3.0.0+</version>
<superClass>PluginContainer</superClass>
<fields>
+ <!-- [ jdcasey:06-Mar-2005 ] Added to handle version management, etc. for
+ | plugins to be used in sub-projects. -->
+ <field>
+ <name>pluginManagement</name>
+ <version>4.0.0</version>
+ <required>false</required>
+ <description><![CDATA[
+ Default plugin information to be made available for reference by
+ projects derived from this one. This plugin configuration will not
+ be validated or bound to the lifecycle unless referenced. Any local
+ configuration for a given plugin will override the plugin's entire
+ definition here.
+ ]]></description>
+ <association>
+ <type>PluginManagement</type>
+ </association>
+ </field>
+ </fields>
+ </class>
+ <class>
+ <name>Build</name>
+ <version>3.0.0+</version>
+ <superClass>PluginConfiguration</superClass>
+ <fields>
<field>
<name>defaultGoal</name>
<version>3.0.0+</version>
@@ -899,23 +934,6 @@
]]></description>
<type>String</type>
</field>
- <!-- [ jdcasey:06-Mar-2005 ] Added to handle version management, etc. for
- | plugins to be used in sub-projects. -->
- <field>
- <name>pluginManagement</name>
- <version>4.0.0</version>
- <required>false</required>
- <description><![CDATA[
- Default plugin information to be made available for reference by
- projects derived from this one. This plugin configuration will not
- be validated or bound to the lifecycle unless referenced. Any local
- configuration for a given plugin will override the plugin's entire
- definition here.
- ]]></description>
- <association>
- <type>PluginManagement</type>
- </association>
- </field>
</fields>
</class>
<class>
@@ -2189,6 +2207,225 @@
</field>
</fields>
</class>
+ <!-- Profile support -->
+ <class>
+ <name>Profile</name>
+ <version>4.0.0</version>
+ <description><![CDATA[
+ Modifications to the build process which is keyed on some
+ sort of environmental parameter.
+ ]]></description>
+ <fields>
+ <field>
+ <name>id</name>
+ <required>true</required>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description>The ID of this build profile, for activation
+ purposes.</description>
+ </field>
+ <field>
+ <name>activation</name>
+ <version>1.0.0</version>
+ <description><![CDATA[The conditional logic which will automatically
+ trigger the inclusion of this profile.]]></description>
+ <association>
+ <type>Activation</type>
+ </association>
+ </field>
+ <field>
+ <name>modules</name>
+ <version>4.0.0</version>
+ <description>The modules to build in addition to the current project</description>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>dependencies</name>
+ <version>3.0.0+</version>
+ <description><![CDATA[
+ <p>
+ This element describes all of the dependencies associated with a
+ project. Each dependency is described by a
+ <code>dependency</code> element, which is then described by
+ additional elements (described below).
+ </p>
+ <p>
+ These dependencies are used to construct a classpath for your
+ project during the build process.
+ </p>
+ <p>
+ Maven can automatically download these dependencies from a
+ <a href="/user-guide.html#Remote%20Repository%20Layout">remote repository</a>.
+ </p>
+ <p>
+ The filename that Maven downloads from the repository is
+ <code>artifactId-version.jar</code> where <code>artifactId</code>
+ corresponds to the <code>artifactId</code> element and
+ <code>version</code> corresponds to the <code>version</code> element.
+ </p>
+ <p>
+ When Maven goes looking for a dependency in the remote repository,
+ it uses the dependency element to construct the URL to download
+ from. This URL is defined as:
+ </p>
+ <div class="source">
+ <pre>${repo}/${groupId}/${type}s/${artifactId}-${version}.${type}</pre>
+ </div>
+ <p>
+ Where
+ </p>
+ <dl>
+ <dt>repo</dt>
+ <dd>
+ is the remote repository URL specified by
+ <code>${maven.repo.remote}</code>
+ </dd>
+
+ <dt>groupId</dt>
+ <dd>is taken from the dependency element</dd>
+
+ <dt>type</dt>
+ <dd>is taken from the dependency element</dd>
+
+ <dt>artifactId</dt>
+ <dd>is taken from the dependency element</dd>
+
+ <dt>version</dt>
+ <dd>is taken from the dependency element</dd>
+ </dl>
+ ]]></description>
+ <association>
+ <type>Dependency</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ <comment>These should ultimately only be compile time dependencies when transitive dependencies come into play.</comment>
+ </field>
+ <field>
+ <name>reports</name>
+ <version>4.0.0</version>
+ <description><![CDATA[
+ This element includes the specification of reports to be
+ included in a Maven-generated site. These reports will be run
+ when a user executes <code>maven site</code>. All of the
+ reports will be included in the navigation bar for browsing in
+ the order they are specified.
+ ]]></description>
+ <association>
+ <type>Reports</type>
+ </association>
+ </field>
+ <field>
+ <name>distributionManagement</name>
+ <version>4.0.0</version>
+ <description><![CDATA[Distribution information for a project.]]></description>
+ <association>
+ <type>DistributionManagement</type>
+ </association>
+ </field>
+ <!-- [ jdcasey:01-Feb-2005 ] Added to handle version management for
+ | dependencies to be used in sub-projects. -->
+ <field>
+ <name>dependencyManagement</name>
+ <version>4.0.0</version>
+ <required>false</required>
+ <description><![CDATA[
+ Default dependency information for grouped projects inheriting from
+ this one. The dependency information here will not be checked.
+ Instead, when a POM derived from this one declares a dependency
+ described by a groupId and an artifactId (version not necessary),
+ the entries in here will supply default values for that dependency.
+ Any locally-supplied information for a particular dependency will
+ overwrite any information specified here for that project.
+ ]]></description>
+ <association>
+ <type>DependencyManagement</type>
+ </association>
+ </field>
+ <field>
+ <name>repositories</name>
+ <version>4.0.0</version>
+ <description><![CDATA[The lists of the remote repositories]]></description>
+ <association>
+ <type>Repository</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>pluginRepositories</name>
+ <version>4.0.0</version>
+ <description><![CDATA[
+ The lists of the remote repositories for discovering plugins
+ ]]></description>
+ <association>
+ <type>Repository</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ <comment><![CDATA[
+ This may be removed or relocated in the near future.
+ It is undecided whether plugins really need a remote repository set
+ of their own.
+ ]]></comment>
+ </field>
+ <field>
+ <name>build</name>
+ <version>4.0.0</version>
+ <description><![CDATA[
+ Stripped down version of the build section, allowing only plugin configuration.
+ ]]></description>
+ <association>
+ <type>PluginConfiguration</type>
+ </association>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ // We don't want this to be parseable...it's sort of 'hidden'
+ private Object configuration;
+
+ public void setConfiguration( Object configuration )
+ {
+ this.configuration = configuration;
+ }
+
+ public Object getConfiguration()
+ {
+ return configuration;
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+ <class>
+ <name>Activation</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ The conditions within the build runtime environment which will trigger
+ the automatic inclusion of the parent build profile.
+ ]]></description>
+ <fields>
+ <field>
+ <name>jdk</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description><![CDATA[
+ Specifies that this profile will be activated when a matching JDK is detected.
+ ]]></description>
+ </field>
+ <field>
+ <name>property</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description><![CDATA[
+ Specifies that this profile will be activated when this System property is specified.
+ ]]></description>
+ </field>
+ </fields>
+ </class>
+ <!-- /BuildProfile support -->
</classes>
</model>
Added: maven/components/trunk/maven-profile/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-profile/pom.xml?rev=179233&view=auto
==============================================================================
--- maven/components/trunk/maven-profile/pom.xml (added)
+++ maven/components/trunk/maven-profile/pom.xml Tue May 31 09:24:34 2005
@@ -0,0 +1,41 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>maven</artifactId>
+ <groupId>org.apache.maven</groupId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>maven-profile</artifactId>
+ <name>Maven Profile Model</name>
+ <dependencies>
+ <dependency>
+ <groupId>plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.0-alpha-2</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.modello</groupId>
+ <artifactId>modello-maven-plugin</artifactId>
+ <version>1.0-alpha-2</version>
+ <goals>
+ <goal>
+ <id>xpp3-writer</id>
+ </goal>
+ <goal>
+ <id>java</id>
+ </goal>
+ <goal>
+ <id>xpp3-reader</id>
+ </goal>
+ </goals>
+ <configuration>
+ <version>1.0.0</version>
+ <model>profiles.mdo</model>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/components/trunk/maven-profile/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author"
Propchange: maven/components/trunk/maven-profile/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: maven/components/trunk/maven-profile/profiles.mdo
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-profile/profiles.mdo?rev=179233&view=auto
==============================================================================
--- maven/components/trunk/maven-profile/profiles.mdo (added)
+++ maven/components/trunk/maven-profile/profiles.mdo Tue May 31 09:24:34 2005
@@ -0,0 +1,201 @@
+<model>
+ <id>profiles</id>
+ <name>Profiles</name>
+ <description><![CDATA[
+ Project-local overrides to the build process based on detected or user-provided environmental parameters.
+ This is the model specification for ${basedir}/profiles.xml.
+ ]]></description>
+ <defaults>
+ <default>
+ <key>package</key>
+ <value>org.apache.maven.model.profiles</value>
+ </default>
+ </defaults>
+ <classes>
+ <class rootElement="true" xml.tagName="profilesXml">
+ <name>ProfilesRoot</name>
+ <version>1.0.0</version>
+ <description>Root element of the profiles.xml file.</description>
+ <fields>
+ <field>
+ <name>profiles</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ Configuration of build profiles for adjusting the build
+ according to environmental parameters
+ ]]></description>
+ <association>
+ <type>Profile</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>activeProfiles</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ List of manually-activated build profiles, specified in the order in which
+ they should be applied.
+ ]]></description>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ </class>
+ <class>
+ <name>Profile</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ Modifications to the build process which is keyed on some
+ sort of environmental parameter.
+ ]]></description>
+ <fields>
+ <field>
+ <name>id</name>
+ <required>true</required>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description>The ID of this build profile, for activation
+ purposes.</description>
+ </field>
+ <field>
+ <name>activation</name>
+ <version>1.0.0</version>
+ <description><![CDATA[The conditional logic which will automatically
+ trigger the inclusion of this profile.]]></description>
+ <association>
+ <type>Activation</type>
+ </association>
+ </field>
+ <field>
+ <name>configuration</name>
+ <description>Extended configuration specific to this notifier goes
+ here.</description>
+ <type>DOM</type>
+ </field>
+ <field>
+ <name>repositories</name>
+ <version>1.0.0</version>
+ <description><![CDATA[The lists of the remote repositories]]>
+ </description>
+ <association>
+ <type>Repository</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>pluginRepositories</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ The lists of the remote repositories for discovering plugins
+ ]]></description>
+ <association>
+ <type>Repository</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ <comment><![CDATA[ This may be removed or relocated in the near
+ future. It is undecided whether plugins really need a remote
+ repository set of their own. ]]></comment>
+ </field>
+ </fields>
+ </class>
+ <class>
+ <name>Activation</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ The conditions within the build runtime environment which will trigger
+ the automatic inclusion of the parent build profile.
+ ]]></description>
+ <fields>
+ <field>
+ <name>jdk</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description><![CDATA[
+ Specifies that this profile will be activated when a matching JDK is detected.
+ ]]></description>
+ </field>
+ <field>
+ <name>property</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description><![CDATA[
+ Specifies that this profile will be activated when this System property is specified.
+ ]]></description>
+ </field>
+ </fields>
+ </class>
+ <class>
+ <name>Repository</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ Repository contains the information needed
+ for establishing connections with remote repoistory
+ ]]></description>
+ <fields>
+ <field>
+ <name>id</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ A unique identifier for a repository.
+ ]]></description>
+ <type>String</type>
+ </field>
+ <field>
+ <name>name</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ Human readable name of the repository
+ ]]></description>
+ <type>String</type>
+ </field>
+ <field>
+ <name>url</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ The url of the repository
+ ]]></description>
+ <type>String</type>
+ </field>
+ <field>
+ <name>snapshotPolicy</name>
+ <version>1.0.0</version>
+ <description> The policy for downloading snapshots - can be "always",
+ "daily" (default), "interval:XXX" (in minutes) or "never".
+ </description>
+ <type>String</type>
+ <defaultValue>daily</defaultValue>
+ </field>
+ <field>
+ <name>layout</name>
+ <version>1.0.0</version>
+ <description>The type of layout this repository uses for locating and
+ storing artifacts - can be "legacy" or "default".</description>
+ <type>String</type>
+ <defaultValue>default</defaultValue>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <version>1.0.0</version>
+ <code><![CDATA[
+ public boolean equals( Object obj )
+ {
+ Repository other = ( Repository ) obj;
+
+ boolean retValue = false;
+
+ if ( id != null )
+ {
+ retValue = id.equals( other.id );
+ }
+
+ return retValue;
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+ </classes>
+</model>
\ No newline at end of file
Propchange: maven/components/trunk/maven-profile/profiles.mdo
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author"
Modified: maven/components/trunk/maven-settings/settings.mdo
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-settings/settings.mdo?rev=179233&r1=179232&r2=179233&view=diff
==============================================================================
--- maven/components/trunk/maven-settings/settings.mdo (original)
+++ maven/components/trunk/maven-settings/settings.mdo Tue May 31 09:24:34 2005
@@ -8,7 +8,7 @@
<defaults>
<default>
<key>package</key>
- <value>org.apache.maven.settings</value>
+ <value>org.apache.maven.model.settings</value>
</default>
</defaults>
<classes>
@@ -17,6 +17,30 @@
<version>1.0.0</version>
<description>Root element of the user configuration file.</description>
<fields>
+ <field>
+ <name>localRepository</name>
+ <version>1.0.0</version>
+ <required>true</required>
+ <description><![CDATA[The local repository.]]></description>
+ <type>String</type>
+ </field>
+ <!-- [JC] Not ready to use yet, so I'm making if unavailable for now. -->
+ <!-- field>
+ <name>passwordStore</name>
+ <version>1.0.0</version>
+ <required>false</required>
+ <description><![CDATA[The keystore used to store passwords.]]></description>
+ <type>String</type>
+ </field -->
+ <field>
+ <name>offline</name>
+ <version>1.0.0</version>
+ <required>false</required>
+ <description><![CDATA[Indicate whether maven should operate in offline mode full-time.]]>
+ </description>
+ <type>boolean</type>
+ <defaultValue>false</defaultValue>
+ </field>
<!-- [JC] Not ready to use yet, so I'm making if unavailable for now. -->
<!-- field>
<name>jdks</name>
@@ -64,9 +88,8 @@
<field>
<name>mirrors</name>
<version>1.0.0</version>
- <description>
- Configuration of download mirrors for repositories.
- </description>
+ <description> Configuration of download mirrors for repositories.
+ </description>
<association>
<type>Mirror</type>
<multiplicity>*</multiplicity>
@@ -76,69 +99,33 @@
<name>profiles</name>
<version>1.0.0</version>
<description><![CDATA[
- Configuration for different runtime profiles for maven itself. For
- example, this will allow plugin developers to switch from a "work"
- local repository to a "testing" local repository. It may also allow
- configuration of such things as password keystore, etc. Once again,
- the active profile will be switchable via either the defaults section
- or the command line (read: system properties).
+ Configuration of build profiles for adjusting the build
+ according to environmental parameters
]]></description>
<association>
<type>Profile</type>
<multiplicity>*</multiplicity>
</association>
</field>
+ <field>
+ <name>activeProfiles</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ List of manually-activated build profiles, specified in the order in which
+ they should be applied.
+ ]]></description>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
</fields>
<codeSegments>
<codeSegment>
<version>1.0.0</version>
<code><![CDATA[
- private Profile activeProfile;
private Proxy activeProxy;
- public synchronized void initializeActiveProfile(String localRepository)
- {
- if(getActiveProfile() == null)
- {
- Profile profile = new Profile();
- profile.setLocalRepository(localRepository);
- profile.setActive(true);
-
- addProfile(profile);
- activeProfile = profile;
- }
- }
-
- public synchronized Profile getActiveProfile()
- {
- if(activeProfile == null)
- {
- List profiles = getProfiles();
- if ( profiles != null && !profiles.isEmpty() )
- {
- if ( profiles.size() > 1 )
- {
- for ( Iterator it = profiles.iterator(); it.hasNext(); )
- {
- Profile profile = (Profile) it.next();
- if ( profile.isActive() )
- {
- activeProfile = profile;
- break;
- }
- }
- }
- else
- {
- // If we only have one profile, use it as the active one.
- activeProfile = (Profile) profiles.get( 0 );
- }
- }
- }
-
- return activeProfile;
- }
-
public synchronized Proxy getActiveProxy()
{
if(activeProxy == null)
@@ -233,7 +220,8 @@
<version>1.0.0</version>
<required>false</required>
<defaultValue>false</defaultValue>
- <description><![CDATA[Whether this proxy configuration is the active one.]]></description>
+ <description><![CDATA[Whether this proxy configuration is the active one.]]>
+ </description>
<type>boolean</type>
</field>
<field>
@@ -295,7 +283,8 @@
<field>
<name>username</name>
<version>1.0.0</version>
- <description><![CDATA[The username used to authenticate.]]></description>
+ <description><![CDATA[The username used to authenticate.]]>
+ </description>
<type>String</type>
</field>
<field>
@@ -309,7 +298,8 @@
<field>
<name>privateKey</name>
<version>1.0.0</version>
- <description><![CDATA[The private key location used to authenticate.]]></description>
+ <description><![CDATA[The private key location used to authenticate.]]>
+ </description>
<type>String</type>
</field>
<field>
@@ -323,97 +313,209 @@
</fields>
</class>
<class>
- <name>Profile</name>
+ <name>Mirror</name>
<version>1.0.0</version>
+ <description> A download mirror for a given repository. </description>
<fields>
<field>
- <name>active</name>
+ <name>id</name>
+ <required>true</required>
<version>1.0.0</version>
- <required>false</required>
- <defaultValue>false</defaultValue>
- <description><![CDATA[Whether this is the active maven profile.]]></description>
- <type>boolean</type>
+ <type>String</type>
+ <description> The server ID of this mirror. This must -not- be the
+ same as that of the repository you are mirroring. </description>
</field>
<field>
- <name>localRepository</name>
- <version>1.0.0</version>
+ <name>mirrorOf</name>
<required>true</required>
- <description><![CDATA[The local repository.]]></description>
+ <version>1.0.0</version>
<type>String</type>
+ <description> The server ID of the repository being mirrored, eg
+ "central". </description>
</field>
- <!-- [JC] Not ready to use yet, so I'm making if unavailable for now. -->
- <!-- field>
- <name>passwordStore</name>
- <version>1.0.0</version>
+ <field>
+ <name>name</name>
<required>false</required>
- <description><![CDATA[The keystore used to store passwords.]]></description>
+ <version>1.0.0</version>
<type>String</type>
- </field -->
+ <description> The optional name that describes the mirror.
+ </description>
+ </field>
<field>
- <name>offline</name>
+ <name>url</name>
+ <required>true</required>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description> The URL of the mirror repository. </description>
+ </field>
+ <!--
+ <field>
+ <name>allowOriginal</name>
<version>1.0.0</version>
- <required>false</required>
- <description><![CDATA[Indicate whether maven should operate in offline mode full-time.]]></description>
<type>boolean</type>
- <defaultValue>false</defaultValue>
+ <defaultValue>true</defaultValue>
+ <description>
+ Whether to allow the user of the original as a fallback if an artifact is not found on the mirror.
+ </description>
</field>
+-->
</fields>
</class>
+ <!-- Profile support -->
<class>
- <name>Mirror</name>
+ <name>Profile</name>
<version>1.0.0</version>
- <description>
- A download mirror for a given repository.
- </description>
+ <description><![CDATA[
+ Modifications to the build process which is keyed on some
+ sort of environmental parameter.
+ ]]></description>
<fields>
<field>
<name>id</name>
<required>true</required>
<version>1.0.0</version>
<type>String</type>
- <description>
- The server ID of this mirror. This must -not- be the same as that of the repository you are mirroring.
- </description>
+ <description>The ID of this build profile, for activation
+ purposes.</description>
</field>
<field>
- <name>mirrorOf</name>
- <required>true</required>
+ <name>activation</name>
+ <version>1.0.0</version>
+ <description><![CDATA[The conditional logic which will automatically
+ trigger the inclusion of this profile.]]></description>
+ <association>
+ <type>Activation</type>
+ </association>
+ </field>
+ <field>
+ <name>configuration</name>
+ <description>Extended configuration specific to this notifier goes
+ here.</description>
+ <type>DOM</type>
+ </field>
+ <field>
+ <name>repositories</name>
+ <version>1.0.0</version>
+ <description><![CDATA[The lists of the remote repositories]]>
+ </description>
+ <association>
+ <type>Repository</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>pluginRepositories</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ The lists of the remote repositories for discovering plugins
+ ]]></description>
+ <association>
+ <type>Repository</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ <comment><![CDATA[ This may be removed or relocated in the near
+ future. It is undecided whether plugins really need a remote
+ repository set of their own. ]]></comment>
+ </field>
+ </fields>
+ </class>
+ <class>
+ <name>Activation</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ The conditions within the build runtime environment which will trigger
+ the automatic inclusion of the parent build profile.
+ ]]></description>
+ <fields>
+ <field>
+ <name>jdk</name>
<version>1.0.0</version>
<type>String</type>
- <description>
- The server ID of the repository being mirrored, eg "central".
- </description>
+ <description><![CDATA[
+ Specifies that this profile will be activated when a matching JDK is detected.
+ ]]></description>
+ </field>
+ <field>
+ <name>property</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description><![CDATA[
+ Specifies that this profile will be activated when this System property is specified.
+ ]]></description>
+ </field>
+ </fields>
+ </class>
+ <class>
+ <name>Repository</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ Repository contains the information needed
+ for establishing connections with remote repoistory
+ ]]></description>
+ <fields>
+ <field>
+ <name>id</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ A unique identifier for a repository.
+ ]]></description>
+ <type>String</type>
</field>
<field>
<name>name</name>
- <required>false</required>
<version>1.0.0</version>
+ <description><![CDATA[
+ Human readable name of the repository
+ ]]></description>
<type>String</type>
- <description>
- The optional name that describes the mirror.
- </description>
</field>
<field>
<name>url</name>
- <required>true</required>
<version>1.0.0</version>
+ <description><![CDATA[
+ The url of the repository
+ ]]></description>
<type>String</type>
- <description>
- The URL of the mirror repository.
- </description>
</field>
-<!--
<field>
- <name>allowOriginal</name>
+ <name>snapshotPolicy</name>
<version>1.0.0</version>
- <type>boolean</type>
- <defaultValue>true</defaultValue>
- <description>
- Whether to allow the user of the original as a fallback if an artifact is not found on the mirror.
- </description>
+ <description> The policy for downloading snapshots - can be "always",
+ "daily" (default), "interval:XXX" (in minutes) or "never".
+ </description>
+ <type>String</type>
+ <defaultValue>daily</defaultValue>
+ </field>
+ <field>
+ <name>layout</name>
+ <version>1.0.0</version>
+ <description>The type of layout this repository uses for locating and
+ storing artifacts - can be "legacy" or "default".</description>
+ <type>String</type>
+ <defaultValue>default</defaultValue>
</field>
--->
</fields>
+ <codeSegments>
+ <codeSegment>
+ <version>1.0.0</version>
+ <code><![CDATA[
+ public boolean equals( Object obj )
+ {
+ Repository other = ( Repository ) obj;
+
+ boolean retValue = false;
+
+ if ( id != null )
+ {
+ retValue = id.equals( other.id );
+ }
+
+ return retValue;
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
</class>
+ <!-- /BuildProfile support -->
</classes>
-</model>
+</model>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org