mirror of https://github.com/apache/maven.git
[MNG-1995] - interpolation of boolean values.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@763351 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
15ef04371b
commit
9a4e614d86
|
@ -2116,8 +2116,8 @@
|
|||
</description>
|
||||
<type>String</type>
|
||||
</field>
|
||||
<field>
|
||||
<name>filtering</name>
|
||||
<field xml.tagName="filtering">
|
||||
<name>filteringValue</name>
|
||||
<version>3.0.0+</version>
|
||||
<description>
|
||||
<![CDATA[
|
||||
|
@ -2126,8 +2126,7 @@
|
|||
properties in the files listed in the <code>filters</code> element.
|
||||
]]>
|
||||
</description>
|
||||
<type>boolean</type>
|
||||
<defaultValue>false</defaultValue>
|
||||
<type>String</type>
|
||||
</field>
|
||||
<field>
|
||||
<name>mergeId</name>
|
||||
|
@ -2158,7 +2157,17 @@
|
|||
setMergeId( "resource-" + (mergeIdCounter++) );
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFiltering()
|
||||
{
|
||||
return filteringValue != null ? (new Boolean(filteringValue)).booleanValue() : false;
|
||||
}
|
||||
|
||||
public void setFiltering( boolean filtering )
|
||||
{
|
||||
filteringValue = String.valueOf(filtering);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
|
@ -2439,12 +2448,11 @@
|
|||
<version>4.0.0</version>
|
||||
<description>Download policy.</description>
|
||||
<fields>
|
||||
<field>
|
||||
<name>enabled</name>
|
||||
<field xml.tagName="enabled">
|
||||
<name>enabledValue</name>
|
||||
<version>4.0.0</version>
|
||||
<description>Whether to use this repository for downloading this type of artifact.</description>
|
||||
<type>boolean</type>
|
||||
<defaultValue>true</defaultValue>
|
||||
<type>String</type>
|
||||
</field>
|
||||
<field>
|
||||
<name>updatePolicy</name>
|
||||
|
@ -2480,6 +2488,26 @@
|
|||
<type>String</type>
|
||||
</field>
|
||||
</fields>
|
||||
<codeSegments>
|
||||
<codeSegment>
|
||||
<version>4.0.0</version>
|
||||
<code>
|
||||
<![CDATA[
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return enabledValue != null ? (new Boolean(enabledValue)).booleanValue() : false;
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enabled )
|
||||
{
|
||||
enabledValue = String.valueOf(enabled);
|
||||
}
|
||||
|
||||
]]>
|
||||
</code>
|
||||
</codeSegment>
|
||||
</codeSegments>
|
||||
</class>
|
||||
|
||||
<!--@todo find better solution for management of site deployments -->
|
||||
|
|
|
@ -158,7 +158,7 @@ public class BuildProcessor
|
|||
{
|
||||
Resource r = new Resource();
|
||||
r.setDirectory( resource.getDirectory());
|
||||
r.setFiltering( resource.isFiltering() );
|
||||
r.setFilteringValue( resource.getFilteringValue() );
|
||||
r.setMergeId( resource.getMergeId() );
|
||||
r.setTargetPath( resource.getTargetPath() );
|
||||
r.setExcludes( new ArrayList<String>(resource.getExcludes()) );
|
||||
|
|
|
@ -91,7 +91,7 @@ public class RepositoriesProcessor extends BaseProcessor
|
|||
{
|
||||
RepositoryPolicy p = new RepositoryPolicy();
|
||||
p.setChecksumPolicy( policy.getChecksumPolicy() );
|
||||
p.setEnabled( policy.isEnabled() );
|
||||
p.setEnabledValue(policy.getEnabledValue());
|
||||
p.setUpdatePolicy( policy.getUpdatePolicy() );
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -1307,13 +1307,15 @@ public class PomConstructionTest
|
|||
assertEquals("2.1", pom.getValue( "build/plugins[1]/version" ));
|
||||
}
|
||||
|
||||
/* FIXME: MNG-1995
|
||||
/* MNG-1995 */
|
||||
public void testBooleanInterpolation()
|
||||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "boolean-interpolation" );
|
||||
assertTrue ((Boolean) pom.getValue( "repositories[2]/releases/enabled" ) );
|
||||
assertTrue((Boolean) pom.getValue( "build/resources[1]/filtering" ) );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* MNG-3899 */
|
||||
public void testBuildExtensionInheritance()
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you 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.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.maven.its.mng1995</groupId>
|
||||
<artifactId>test1</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
<name>Maven Integration Test :: MNG-1995</name>
|
||||
<description>
|
||||
Verify that POM fields that are of type boolean can be interpolated with expressions.
|
||||
</description>
|
||||
|
||||
<properties>
|
||||
<filter.resources>true</filter.resources>
|
||||
<releasesEnabled>true</releasesEnabled>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven-core-it</id>
|
||||
<url>file:///${basedir}/repo</url>
|
||||
<releases>
|
||||
<!-- That's the boolean POM field we would like to interpolate -->
|
||||
<enabled>${releasesEnabled}</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<!-- That's the boolean POM field we would like to interpolate -->
|
||||
<filtering>${filter.resources}</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-expression</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<configuration>
|
||||
<outputFile>target/expression.properties</outputFile>
|
||||
<expressions>
|
||||
<expression>project/build/resources/0/filtering</expression>
|
||||
<expression>project/repositories</expression>
|
||||
</expressions>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>eval</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
Loading…
Reference in New Issue