Comments (7)
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.
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.
Thanks!
from sortpom.
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 :
- Binds by default to the lifecycle phase: package.
- Invokes the execution of the lifecycle phase generate-sources prior to executing itself.
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.
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.
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.
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)
- Xml formatting HOT 12
- sorting doesn't work in >=v3.0.0 HOT 11
- no sort xmls with doctype HOT 4
- Add entry for the 3.2.1 release on the wiki page `Versions` HOT 2
- Tone down sortpom output HOT 6
- Properties configuration Suggestion HOT 7
- Setting to disable pom sorting? HOT 4
- LATEST using in pom is deprecated and will be removed from maven 4 HOT 8
- Handle plugin warnings HOT 1
- Dependency Dashboard
- Setup Maven 4 build pipe HOT 1
- Preserve formatting inside project element HOT 9
- Add configuration to suppress XML declaration HOT 7
- Add configuration for newline at the end of file HOT 6
- XML tag with `xml:space="preserve"` containing only spaces should not be collapsed HOT 4
- Attributes resulting in long lines should be wrapped or chopped down HOT 10
- Revisit schema location indent choice HOT 11
- Java Class File Version 52+ ( 55=Java 11 and/or 61=Java 17)
- Newlines aren't kept at beginning or end of String content. HOT 4
- Not sorting with mvn comand HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sortpom.