Skip to content

maven4 regression bug: script2.groovy: 1: unexpected char: '\' @ line 1, column 40. #34

@hohwille

Description

@hohwille

I have tested maven4 update (4.0.0-rc1) and found that groovy-maven-plugin stops working after this update:

Execution default of goal org.codehaus.gmaven:groovy-maven-plugin:2.1.1:execute failed: startup failed:
[ERROR] script2.groovy: 1: unexpected char: '\' @ line 1, column 40.
[ERROR]    def parts = "1.5.12.0-SNAPSHOT".split("\.")
[ERROR]                                           ^
[ERROR]

With maven 3.9 (e.g. 3.9.6 or 3.9.9) this used to work fine.
Configuration:

<plugin>
  <groupId>org.codehaus.gmaven</groupId>
  <artifactId>groovy-maven-plugin</artifactId>
  <executions>
    <execution>
      <phase>generate-resources</phase>
      <goals>
        <goal>execute</goal>
      </goals>
      <configuration>
        <source><![CDATA[
          def versionSegments = "${project.version}".split("\\.")
          ...
          ]]>
        </source>
      </configuration>
    </execution>
  </executions>
</plugin>

Can you confirm this bug? Is this really a bug of groovy-maven-plugin or is there a general bug in maven 4.0 resolving backslashes in POM (CDATA sections)?

p.s.: Using double quotes vs. single quotes for the regex string literal does not make any difference. It works with 3.9 and fails with 4.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions