Add tab completion and history functionality using the jline library. New property maven.console.completor.goals. Upgrade to commons-jelly-tags-interaction-1.1. git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@416733 13f79535-47bb-0310-9956-ffa450edef68
88 lines
3.0 KiB
XML
88 lines
3.0 KiB
XML
<?xml version="1.0"?>
|
|
<!--
|
|
/*
|
|
* 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.
|
|
*/
|
|
-->
|
|
|
|
|
|
<project
|
|
xmlns:j="jelly:core"
|
|
xmlns:i="jelly:interaction"
|
|
xmlns:log="jelly:log"
|
|
xmlns:util="jelly:util">
|
|
|
|
<goal name="console" description="Run the Maven console">
|
|
<attainGoal name="console:help"/>
|
|
<j:set var="lastGoal" value="${maven.console.first}"/>
|
|
<j:set var="followOn" value="true"/>
|
|
<j:while test="${followOn}">
|
|
<log:info/>
|
|
<util:tokenize var="completorGoals" delim=",">${maven.console.completor.goals}</util:tokenize>
|
|
<i:ask question="${pom.artifactId} ${pom.currentVersion} >" answer="goal" default="${lastGoal}" completor="${completorGoals}"/>
|
|
<j:choose>
|
|
<j:when test="${goal.indexOf('=') == '0'}">
|
|
<j:set var="prop" value="${goal.substring(1)}" />
|
|
<log:info>${prop} = ${context.getVariable(prop)}</log:info>
|
|
</j:when>
|
|
<j:when test="${goal.indexOf('=') gt 0}">
|
|
<attainGoal name="console:set-properties" />
|
|
</j:when>
|
|
<j:when test="${goal=='help'}">
|
|
<attainGoal name="console:help"/>
|
|
</j:when>
|
|
<j:when test="${goal=='quit'}">
|
|
<j:set var="followOn" value="false"/>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<j:catch var="ex">
|
|
<util:tokenize var="goals" delim=" ,;">${goal}</util:tokenize>
|
|
<j:forEach var="partGoal" items="${goals}">
|
|
<attainGoal name="${partGoal}"/>
|
|
</j:forEach>
|
|
<j:set var="lastGoal" value="${goal}"/>
|
|
</j:catch>
|
|
<j:if test="${ex != null}">
|
|
${pom.getContext().removeVariable("maven.test.failure")}
|
|
<log:info>${ex}</log:info>
|
|
</j:if>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
<j:if test="${followOn=='false'}">
|
|
<log:info>Bye !</log:info>
|
|
</j:if>
|
|
</j:while>
|
|
</goal>
|
|
|
|
<goal name="console:set-properties">
|
|
<util:tokenize var="propertyPieces" delim="=">${goal}</util:tokenize>
|
|
<log:info>Setting property ${propertyPieces[0]} to ${propertyPieces[1]}</log:info>
|
|
<j:set var="${propertyPieces[0]}" value="${propertyPieces[1]}" scope="parent" />
|
|
</goal>
|
|
|
|
<goal name="console:help" description="Print the help message.">
|
|
<log:info>
|
|
The following commands are available:
|
|
|
|
help - this message
|
|
<goalname> - attain a goal
|
|
<property>=<value> - set a property value
|
|
=<property> - display a property value
|
|
quit - quits the console
|
|
|
|
</log:info>
|
|
</goal>
|
|
</project>
|