ijemmy / maven-replacer-plugin

Automatically exported from code.google.com/p/maven-replacer-plugin
MIT License
0 stars 0 forks source link

Error during XML replacement: Content is not allowed in prolog. #99

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use attached pom.xml
2. Create folder src/ next to pom.xml, place empty test.java in there.
3. run "mvn compile"

What is the expected output? What do you see instead?
pom.xml should change its foo property.

Instead maven reports error:

     Failed to execute goal com.google.code.maven-replacer-plugin:maven-replacer-plugin:1.4.1:replace (default) on project testid: Error during XML replacement: Content is not allowed in prolog.

What version of the product are you using?
1.4.1

Please provide any additional information below.

Original issue reported on code.google.com by notdiffi...@gmx.net on 15 Oct 2014 at 2:13

Attachments:

GoogleCodeExporter commented 9 years ago
Try the latest version.

There is a test case in the side project test-plugin-use that shows that xpath 
text replacement should be working and perhaps this was a bug.

Original comment by baker.st...@gmail.com on 19 Oct 2014 at 9:26

GoogleCodeExporter commented 9 years ago
Thank you. I though I was using the latest version. I attached an updated 
pom.xml.

Now the problem is, that whatever is defined in the value tag gets written 
twice to the destination field. So I get:

  <properties>
    <foo>abcabc</foo>
  </properties>

Can you confirm?

Original comment by notdiffi...@gmx.net on 20 Oct 2014 at 7:35

Attachments:

GoogleCodeExporter commented 9 years ago
Try removing the "/text()" part from your xpath parameter. The plugin should 
locate the text component automatically.

Original comment by baker.st...@gmail.com on 21 Oct 2014 at 11:36

GoogleCodeExporter commented 9 years ago
Nope.

<xpath>/project/properties/foo</xpath> still gives me:

[INFO] --- replacer:1.5.3:replace (default) @ testid ---
[Fatal Error] :1:1: Content is not allowed in prolog.
[ERROR] Error during XML replacement: Content is not allowed in prolog.
[INFO] Replacement run on 0 file.

Original comment by notdiffi...@gmx.net on 22 Oct 2014 at 5:57

GoogleCodeExporter commented 9 years ago
I see the same thing happen when using 1.5.3 of this plugin while not even 
using regex. It looks like the replace does not continue after the 
replacement-value.

Original comment by gerke....@gmail.com on 20 Feb 2015 at 12:44

GoogleCodeExporter commented 9 years ago
And this only goes wrong when the first part of the string stays the same. So: 
when the token is 'abc' and the replacement is 'abc-extra' we get 
'abcabc-extra' and when we have token 'abc' and the replacement is 'xyz-extra' 
we get 'xyz-extra'.

Original comment by gerke....@gmail.com on 20 Feb 2015 at 1:00