Issue Details (XML | Word | Printable)

Key: MAVEN-1258
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Cassio Matsuo Nosshe
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Maven 1

Can't run replacetoken ant tag inside maven

Created: 03/May/04 08:01 PM   Updated: 13/Apr/06 05:52 PM
Return to search
Component/s: None
Affects Version/s: 1.0-rc2
Fix Version/s: None

Time Tracking:
Not Specified

Environment:
Maven 1.0-rc2
Windows 2000 SP4
J2SDK 1.4.2_04
Ant 1.5.3


 Description  « Hide

Maven can't run replacetoken tag... Maven, Jelly or Werkz seams to
delete the content inside replacetoken tag before ant is
executed by maven...
<replace file="teste.txt">
<replacetoken>123</replacetoken>
<replacevalue>12345</replacevalue>
</replace>
With this example, String "123" is deleted, and ant (executed by maven) can't run because "The token attribute must not be an empty string."

I've tested it in my build.xml and works:
<target name="teste4">
<replace file="teste.txt">
<replacetoken>123</replacetoken>
<replacevalue>12345</replacevalue>
</replace>
</target>
but with maven 1.0-rc2 (maven.xml), with the same code:
<goal name="teste4">
<replace file="teste.txt">
<replacetoken>123</replacetoken>
<replacevalue>12345</replacevalue>
</replace>
</goal>
...does not work.

NOTE: There is no workaround for this, because replacetoken/replacevalue are used for special characters like '<' and '>' (inside <!CDATA[]>), and the tag <replace file="teste.txt" token="<" value=">"> won't work, because such characters are not allowed in this construction...



Wim Deblauwe added a comment - 04/Apr/05 04:17 AM

Ran into the same problem today with Maven 1.0.2. Luckally, I could use the attributes of the ant task in stead of the nested elements as a workaround.


Brett Porter added a comment - 16/May/05 02:07 AM

confirmed bug


Brett Porter made changes - 16/May/05 02:07 AM
Field Original Value New Value
Description Maven can't run replacetoken tag... Maven, Jelly or Werkz seams to
delete the content inside replacetoken tag before ant is
executed by maven...
<replace file="teste.txt">
   <replacetoken>123</replacetoken>
   <replacevalue>12345</replacevalue>
</replace>
With this example, String "123" is deleted, and ant (executed by maven) can't run because "The token attribute must not be an empty string."

I've tested it in my build.xml and works:
        <target name="teste4">
        <replace file="teste.txt">
                <replacetoken>123</replacetoken>
                <replacevalue>12345</replacevalue>
        </replace>
        </target>
but with maven 1.0-rc2 (maven.xml), with the same code:
    <goal name="teste4">
        <replace file="teste.txt">
                <replacetoken>123</replacetoken>
                <replacevalue>12345</replacevalue>
        </replace>
    </goal>
...does not work.

NOTE: There is no workaround for this, because replacetoken/replacevalue are used for special characters like '<' and '>' (inside <!CDATA[]>), and the tag <replace file="teste.txt" token="<" value=">"> won't work, because such characters are not allowed in this construction...
Maven can't run replacetoken tag... Maven, Jelly or Werkz seams to
delete the content inside replacetoken tag before ant is
executed by maven...
<replace file="teste.txt">
   <replacetoken>123</replacetoken>
   <replacevalue>12345</replacevalue>
</replace>
With this example, String "123" is deleted, and ant (executed by maven) can't run because "The token attribute must not be an empty string."

I've tested it in my build.xml and works:
        <target name="teste4">
        <replace file="teste.txt">
                <replacetoken>123</replacetoken>
                <replacevalue>12345</replacevalue>
        </replace>
        </target>
but with maven 1.0-rc2 (maven.xml), with the same code:
    <goal name="teste4">
        <replace file="teste.txt">
                <replacetoken>123</replacetoken>
                <replacevalue>12345</replacevalue>
        </replace>
    </goal>
...does not work.

NOTE: There is no workaround for this, because replacetoken/replacevalue are used for special characters like '<' and '>' (inside <!CDATA[]>), and the tag <replace file="teste.txt" token="<" value=">"> won't work, because such characters are not allowed in this construction...
Environment Maven 1.0-rc2
Windows 2000 SP4
J2SDK 1.4.2_04
Ant 1.5.3
Maven 1.0-rc2
Windows 2000 SP4
J2SDK 1.4.2_04
Ant 1.5.3
Fix Version/s 1.1-beta-1 [ 11371 ]
Brett Porter made changes - 16/May/05 02:52 AM
Fix Version/s 1.1-beta-2 [ 10211 ]
Fix Version/s 1.1-beta-1 [ 11371 ]
Jacek Laskowski added a comment - 08/Jul/05 04:04 AM

A tested workaround in Maven 1.0.2 is to call <ant:ant/> from within maven.xml. The build.xml file would then look as follows:

<?xml version="1.0" encoding="UTF-8"?>
<project name="temporary workaround" default="replace">

<target name="replace">
<replace file="target/petstore-ear/customer-ejb/META-INF/ejb-jar.xml">
<replacetoken><![CDATA[<ejb-relation-name></ejb-relation-name>]]></replacetoken>
<replacevalue><![CDATA[<!-- ejb-relation-name>Geronimo</ejb-relation-name -->]]></replacevalue>
</replace>
</target>

</project>

It works fine.


Vincent Massol made changes - 11/Aug/05 11:45 AM
Workflow jira [ 25050 ] Maven [ 38368 ]
Brett Porter made changes - 08/Mar/06 10:44 PM
Workflow Maven [ 38368 ] Maven New [ 50778 ]
Arnaud Heritier made changes - 13/Apr/06 05:52 PM
Fix Version/s 1.1-beta-3 [ 11989 ]