mirror of https://github.com/apache/maven.git
PR: MNG-821
Submitted by: Jesse McConnell Reviewed by: Brett Porter Add file existence based profile activation git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@267429 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4aa24791d2
commit
6d3dbc96c7
|
@ -2602,7 +2602,7 @@
|
|||
</codeSegment>
|
||||
</codeSegments>
|
||||
</class>
|
||||
<class>
|
||||
<class>
|
||||
<name>Activation</name>
|
||||
<version>4.0.0</version>
|
||||
<description><![CDATA[
|
||||
|
@ -2628,6 +2628,16 @@
|
|||
<type>ActivationProperty</type>
|
||||
</association>
|
||||
</field>
|
||||
<field>
|
||||
<name>file</name>
|
||||
<version>4.0.0</version>
|
||||
<description><![CDATA[
|
||||
Specifies that this profile will be activated based on existence of a file.
|
||||
]]></description>
|
||||
<association>
|
||||
<type>ActivationFile</type>
|
||||
</association>
|
||||
</field>
|
||||
</fields>
|
||||
</class>
|
||||
<class>
|
||||
|
@ -2654,6 +2664,29 @@
|
|||
</field>
|
||||
</fields>
|
||||
</class>
|
||||
<class>
|
||||
<name>ActivationFile</name>
|
||||
<version>4.0.0</version>
|
||||
<description><![CDATA[
|
||||
This is the file specification used to activate a profile. The missing value will be a the location
|
||||
of a file that needs to exist, and if it doesn't the profile must run. On the other hand exists will test
|
||||
for the existence of the file and if it is there will run the profile.
|
||||
]]></description>
|
||||
<fields>
|
||||
<field>
|
||||
<name>missing</name>
|
||||
<version>4.0.0</version>
|
||||
<type>String</type>
|
||||
<description>The name of the file that should be missing to activate a profile</description>
|
||||
</field>
|
||||
<field>
|
||||
<name>exists</name>
|
||||
<version>4.0.0</version>
|
||||
<type>String</type>
|
||||
<description>The name of the file that should exist to activate a profile</description>
|
||||
</field>
|
||||
</fields>
|
||||
</class>
|
||||
<!-- /BuildProfile support -->
|
||||
<class xml.tagName="plugin">
|
||||
<name>ReportPlugin</name>
|
||||
|
|
|
@ -130,6 +130,16 @@
|
|||
<type>ActivationProperty</type>
|
||||
</association>
|
||||
</field>
|
||||
<field>
|
||||
<name>file</name>
|
||||
<version>1.0.0</version>
|
||||
<description><![CDATA[
|
||||
Specifies that this profile will be activated based on existence of a file.
|
||||
]]></description>
|
||||
<association>
|
||||
<type>ActivationFile</type>
|
||||
</association>
|
||||
</field>
|
||||
</fields>
|
||||
</class>
|
||||
|
||||
|
@ -169,8 +179,7 @@
|
|||
<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>
|
||||
<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>
|
||||
|
@ -196,7 +205,6 @@
|
|||
</codeSegment>
|
||||
</codeSegments>
|
||||
</class>
|
||||
|
||||
<class>
|
||||
<name>Repository</name>
|
||||
<superClass>RepositoryBase</superClass>
|
||||
|
@ -284,7 +292,6 @@
|
|||
</field>
|
||||
</fields>
|
||||
</class>
|
||||
|
||||
<class>
|
||||
<name>ActivationProperty</name>
|
||||
<version>1.0.0</version>
|
||||
|
@ -309,5 +316,28 @@
|
|||
</field>
|
||||
</fields>
|
||||
</class>
|
||||
<class>
|
||||
<name>ActivationFile</name>
|
||||
<version>1.0.0</version>
|
||||
<description><![CDATA[
|
||||
This is the file specification used to activate a profile. The missing value will be a the location
|
||||
of a file that needs to exist, and if it doesn't the profile must run. On the other hand exists will test
|
||||
for the existence of the file and if it is there will run the profile.
|
||||
]]></description>
|
||||
<fields>
|
||||
<field>
|
||||
<name>missing</name>
|
||||
<version>1.0.0</version>
|
||||
<type>String</type>
|
||||
<description>The name of the file that should be missing to activate a profile</description>
|
||||
</field>
|
||||
<field>
|
||||
<name>exists</name>
|
||||
<version>1.0.0</version>
|
||||
<type>String</type>
|
||||
<description>The name of the file that should exist to activate a profile</description>
|
||||
</field>
|
||||
</fields>
|
||||
</class>
|
||||
</classes>
|
||||
</model>
|
||||
</model>
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.maven.profiles;
|
|||
|
||||
import org.apache.maven.model.Activation;
|
||||
import org.apache.maven.model.ActivationProperty;
|
||||
import org.apache.maven.model.ActivationFile;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.apache.maven.model.Repository;
|
||||
|
||||
|
@ -45,7 +46,7 @@ public class ProfilesConversionUtils
|
|||
Activation activation = new Activation();
|
||||
|
||||
activation.setJdk( profileActivation.getJdk() );
|
||||
|
||||
|
||||
org.apache.maven.profiles.ActivationProperty profileProp = profileActivation.getProperty();
|
||||
|
||||
if ( profileProp != null )
|
||||
|
@ -57,7 +58,19 @@ public class ProfilesConversionUtils
|
|||
|
||||
activation.setProperty( prop );
|
||||
}
|
||||
|
||||
org.apache.maven.profiles.ActivationFile profileFile = profileActivation.getFile();
|
||||
|
||||
if ( profileFile != null )
|
||||
{
|
||||
ActivationFile file = new ActivationFile();
|
||||
|
||||
file.setExists( profileFile.getExists() );
|
||||
file.setMissing( profileFile.getMissing() );
|
||||
|
||||
activation.setFile( file );
|
||||
}
|
||||
|
||||
profile.setActivation( activation );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -115,6 +115,16 @@
|
|||
<role-hint>system-property</role-hint>
|
||||
<implementation>org.apache.maven.profiles.activation.SystemPropertyProfileActivator</implementation>
|
||||
</component>
|
||||
<!--
|
||||
|
|
||||
|
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.profiles.activation.ProfileActivator</role>
|
||||
<role-hint>file</role-hint>
|
||||
<implementation>org.apache.maven.profiles.activation.FileProfileActivator</implementation>
|
||||
</component>
|
||||
<!--
|
||||
|
|
||||
|
|
||||
|
|
Loading…
Reference in New Issue