Coder Social home page Coder Social logo

Comments (7)

Ekryd avatar Ekryd commented on July 26, 2024

Hi! I am busy the following days, so it will take some time before I can look at this for real. Thanks for your patience.
ps. it should be the source but but I haven’t experienced your problem. Is it possible to recreate in an integration test?

from sortpom.

sbernard31 avatar sbernard31 commented on July 26, 2024

I will maybe find time to create an integration test that but not sure.

Waiting you could use : sbernard31/leshan#11 to reproduce that.

from sortpom.

Ekryd avatar Ekryd commented on July 26, 2024

Thanks!

from sortpom.

sbernard31 avatar sbernard31 commented on July 26, 2024

I digged a little more about this.

Explanation about why it is called twice ?
I find why the sortpom:verify goal (attached to validate phase by default) is called twice.

This is because my build also run maven-source-plugin:jar goal which :

First try to fix it :
To attach sortpom:verify goal to process-sources, this way maven-source-plugin will execute generate-sources and will not recall it.
==> It seems to work ✔️

Second try to fix it :
Using maven-source-plugin:jar-no-fork which does not invoke `generate-sources. (more details)
==> it seems to work too ✔️

So I guess this is not a sortpom issue.

from sortpom.

sbernard31 avatar sbernard31 commented on July 26, 2024

Before to find this, I begin to write 1 IT test but I was not able to reproduce because in my IT test sortpom:verify was called twice but still on same file.

Even when I was using flatten-maven-plugin, the flattened pom file was created by not used by sortpom... 🤷

So a remaining question (not related to sortpom) is : why IT test and "real use case" behave differently ?

I let the IT test just in case :

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.github.ekryd.sortpom.its</groupId>
  <artifactId>default-configuration</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>SortPom Plugin :: ITs :: Default configuration</name>
  <description>Test default parameters of the plugin</description>
  <url>no-url</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>com.github.ekryd.sortpom</groupId>
        <artifactId>sortpom-maven-plugin</artifactId>
        <version>3.1.4-SNAPSHOT</version>
        <executions>
          <execution>
            <goals>
              <goal>verify</goal>
            </goals>
            <configuration>
              <violationFilename>target/sortpom_reports/violation.xml</violationFilename>
              <verifyFail>stop</verifyFail>
              <verifyFailOn>Strict</verifyFailOn>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.2.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>flatten-maven-plugin</artifactId>
        <version>1.2.7</version>
        <configuration>
          <flattenMode>ossrh</flattenMode>
          <!--  see https://github.com/mojohaus/flatten-maven-plugin/issues/53#issuecomment-388076343 -->
          <outputDirectory>${project.build.directory}</outputDirectory>
          <flattenedPomFilename>${project.artifactId}-${project.version}.pom</flattenedPomFilename>
        </configuration>
        <executions>
          <execution>
            <id>flatten</id>
            <goals>
              <goal>flatten</goal>
            </goals>
            <phase>process-resources</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

from sortpom.

Ekryd avatar Ekryd commented on July 26, 2024

I am glad that the problem was solved for you and thank you for posting it as an issue (in case somebody else stumbles on the same problem).
I guess that the IT test framework does some hacking in the Maven process. The IT tests themselves does not execute in the source directory, but it moves all files to the target/it directory before executing. Perhaps it also caches the pom file input instead of reading the pom between each phase??

from sortpom.

sbernard31 avatar sbernard31 commented on July 26, 2024

I guess that the IT test framework does some hacking in the Maven process. The IT tests themselves does not execute in the source directory, but it moves all files to the target/it directory before executing. Perhaps it also caches the pom file input instead of reading the pom between each phase??

Probably something like this. 🤷

I guess we can close this issue ?

from sortpom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.