You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Matt Raible <ma...@raibledesigns.com> on 2003/02/27 05:34:45 UTC
Regular Expression Replacing
Lets see if I can make this question a bit easier. How do I
<replaceregexp> to replace remove "-" (dashes) from a string?
Thanks,
Matt
> -----Original Message-----
> From: Matt Raible [mailto:matt@raibledesigns.com]
> Sent: Wednesday, February 26, 2003 7:22 AM
> To: user@ant.apache.org
> Subject: Creating a project from the current one
>
>
> I have the following task that creates a new project using
> the existing one.
> I'm having a problem with replacing the current project name
> with the new project name. This is b/c my "new" project name
> contains a dash, and my dbname and project are named the same
> in the old project.
>
> For some context, my existing project is named "appfuse" and
> the one I want to create is "struts-resume". I can't have a
> database named "struts-resume", so I want to detect a dash
> and either (1) prompt the user for a new dbname, or
> (2) rename the database to be the last half of the name "resume".
>
> The basic idea is to create a new project using "appfuse" as
> a starting point.
>
> <target name="new" depends="clean"
> description="creates a new project with the specified name">
> <fail unless="app.name">
> You must specify an app.name using -Dapp.name=NAME
> </fail>
> <echo level="info">Creating new application named
> '${app.name}'...</echo>
> <copy todir="../${app.name}">
> <fileset dir="${basedir}">
> <exclude name="README*.txt"/>
> <exclude name="${webapp.name}*"/>
> <exclude name=".*"/>
> <exclude name="*.log"/>
> <include name="**"/>
> </fileset>
> </copy>
> <copy file="${basedir}/README-new.txt"
> tofile="../${app.name}/README.txt"/>
> <replace dir="../${app.name}" token="${ant.project.name}"
> value="${app.name}" summary="true"/>
> </target>
>
> Thanks,
>
> Matt
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>