Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser does not seem to parse some parts of the XML correctly. #5

Open
vaikas opened this issue Feb 14, 2024 · 1 comment
Open

parser does not seem to parse some parts of the XML correctly. #5

vaikas opened this issue Feb 14, 2024 · 1 comment

Comments

@vaikas
Copy link
Member

vaikas commented Feb 14, 2024

I'm using github.com/2000Slash/gopom to parse the original pom.xml file. It seems to not parse some sections of the XML correctly though, even when just round-tripping an XML file with no patches, there are differences, so I need to dig into it. Maybe some of these are marshaling issues, but some for sure are losing information on the parsing. Here's some things I'm seeing diffs in:

Original:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

Marshalled:

<project xmlns="http://maven.apache.org/POM/4.0.0" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

This is for sure being dropped on the parsing (as debugged by looking at the actual structs returned):

<profiles>
        <profile>
            <id>errorprone-compiler</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <!--suppress MavenModelInspection -->
                        <configuration combine.children="merge">
                            <!-- forking not required due to JVM flags in .mvn/jvm.config -->
                            <!-- see https://errorprone.info/docs/installation#maven -->
                            <!-- Do not fail on error-prone's warnings even for modules using air.compiler.fail-warnings -->
                            <!-- TODO silence warnings we choose to ignore and raise important warnings to error and then remove <failOnWarning> -->
                            <failOnWarning>false</failOnWarning>
                            <compilerArgs>
                                <arg>-XDcompilePolicy=simple</arg>
                                <arg>
                                    -Xplugin:ErrorProne \
                                    -Xep:AnnotateFormatMethod:ERROR \
                                    -Xep:BadComparable:ERROR \
                                    -Xep:BadInstanceof:ERROR \
                                    -Xep:BoxedPrimitiveConstructor:ERROR \
                                    -Xep:ClassCanBeStatic:ERROR \
    <!-- SNIP SNIP SNIP SNIP -->
                                    -XepExcludedPaths:.*/target/generated-(|test-)sources/.*
                                </arg>
                            </compilerArgs>
                            <annotationProcessorPaths>
                                <path>
                                    <groupId>com.google.errorprone</groupId>
                                    <artifactId>error_prone_core</artifactId>
                                    <version>${dep.errorprone.version}</version>
                                </path>
                            </annotationProcessorPaths>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

vs.

<profiles>
    <profile>
      <id>errorprone-compiler</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <annotationProcessorPaths>

                            </annotationProcessorPaths>
              <failOnWarning>false</failOnWarning>
              <compilerArgs>


                            </compilerArgs>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
@vaikas
Copy link
Member Author

vaikas commented Feb 21, 2024

The second part has been fixed here:
https://github.com/vaikas/gopom/blob/configuration-debug/gopom.go#L336

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant