Ekryd / sortpom

Maven plugin that helps the user sort pom.xml.
https://github.com/Ekryd/sortpom/wiki/
BSD 3-Clause "New" or "Revised" License
334 stars 178 forks source link

Properties configuration Suggestion #341

Closed tonycody closed 1 year ago

tonycody commented 1 year ago

sort.createBackupFile sort. Encoding sort.keepBlankLines

e.g. maven.sortpom.createBackupFile maven.sortpom. encoding maven.sortpom.keepBlankLines

You are advised to add a prefix for differentiation. Otherwise, when the properties are configured a lot, you do not know that this is the configuration of the sortpom plug-in。

You can refer to the maven deploy plugin, such as maven.deploy.skip. If it's called skip, and so are the other plugins, there's no way to tell the difference.

sort. Encoding you can use project.build.sourceEncoding

Ekryd commented 1 year ago

🤔 changing the prefix is a quite big breaking change. I wonder if it possible to do some sort of alias? I need to look into this a bit further.

tonycody commented 1 year ago

🤔 changing the prefix is a quite big breaking change. I wonder if it possible to do some sort of alias? I need to look into this a bit further.

Using properties to configure maven plug-ins is a more elegant way, so each maven plug-in must distinguish which plug-in in the property configuration, otherwise when a large number of maven plug-ins are configured through properties, the configuration will be confusing

tonycody commented 1 year ago

🤔 changing the prefix is a quite big breaking change. I wonder if it possible to do some sort of alias? I need to look into this a bit further.

sortpom must be supported

tonycody commented 1 year ago

🤔 changing the prefix is a quite big breaking change. I wonder if it possible to do some sort of alias? I need to look into this a bit further.

From the maven plugin specification, I think even the name needs to be adjusted.

e.g. com.github.ekryd.maven.plugins:maven-sorter-pom-plugin mojo: sorter-pom goal: sort、check、help

Just my personal advice, think this is a better maven plug-in. If the specification were better, maybe there would be more users. You can borrow the style of other popular plugins. For example: Google, Spring

Ekryd commented 1 year ago

Using properties to configure maven plug-ins is a more elegant way, so each maven plug-in must distinguish which plug-in in the property configuration, otherwise when a large number of maven plug-ins are configured through properties, the configuration will be confusing

Out of curiosity, why are you using property configuration for the SortPom plugin instead of having a regular configuration in the pom file?

        <groupId>com.github.ekryd.sortpom</groupId>
        <artifactId>sortpom-maven-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <predefinedSortOrder>custom_1</predefinedSortOrder>
          <lineSeparator>\n</lineSeparator>
          <encoding>${project.build.sourceEncoding}</encoding>
          <sortProperties>true</sortProperties>
          <sortDependencies>scope</sortDependencies>
        </configuration>
Ekryd commented 1 year ago

From the maven plugin specification, I think even the name needs to be adjusted.

e.g. com.github.ekryd.maven.plugins:maven-sorter-pom-plugin mojo: sorter-pom goal: sort、check、help

Only Apache plugins are allowed to use maven as prefix: https://maven.apache.org/guides/plugin/guide-java-plugin-development.html#important-notice-plugin-naming-convention-and-apache-maven-trade

tonycody commented 1 year ago

From the maven plugin specification, I think even the name needs to be adjusted. e.g. com.github.ekryd.maven.plugins:maven-sorter-pom-plugin mojo: sorter-pom goal: sort、check、help

Only Apache plugins are allowed to use maven as prefix: https://maven.apache.org/guides/plugin/guide-java-plugin-development.html#important-notice-plugin-naming-convention-and-apache-maven-trade

Property name, which has nothing to do with apache