Files
maven-plugins/announcement/src/plugin-test/missingVersionTest/maven.xml
T

60 lines
2.1 KiB
XML

<!--
/*
* Copyright 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.
*/
-->
<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven" xmlns:assert="assert" xmlns:util="jelly:util" default="testPlugin">
<goal name="testPlugin" prereqs="testAnnouncement">
<attainGoal name="clean"/>
</goal>
<goal name="testAnnouncement" prereqs="test-default,test-lenient,test-non-lenient"/>
<goal name="test-lenient" prereqs="clean">
<j:set var="maven.announcement.lenient" value="true"/>
<attainGoal name="announcement"/>
<attainGoal name="assert-generated-file"/>
</goal>
<goal name="test-non-lenient" prereqs="clean">
<j:set var="maven.announcement.lenient" value="false"/>
<attainGoal name="catch-it"/>
</goal>
<goal name="test-default" prereqs="clean">
<attainGoal name="catch-it"/>
</goal>
<goal name="assert-generated-file">
<maven:property var="announcementFile" name="maven.announcement.file"
defaultValue="${maven.gen.docs}/announcements/announcement-${pom.currentVersion}.txt"/>
<assert:assertFileExists file="${announcementFile}"/>
<util:file var="generatedFile" name="${announcementFile}"/>
<j:set var="fileSize" value="${generatedFile.length()}"/>
<j:if test="${fileSize==0}">
<ant:fail>File ${announcementFile} was generated empty!</ant:fail>
</j:if>
</goal>
<goal name="catch-it" prereqs="clean">
<j:catch var="e">
<attainGoal name="announcement"/>
</j:catch>
<j:if test="${empty(e)}">
<ant:fail>Goal announcement should have failed</ant:fail>
</j:if>
</goal>
</project>