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

Keep comments on flattened pom #269

Closed
ca-stefan-cordes opened this issue Apr 8, 2022 · 1 comment · Fixed by #270
Closed

Keep comments on flattened pom #269

ca-stefan-cordes opened this issue Apr 8, 2022 · 1 comment · Fixed by #270

Comments

@ca-stefan-cordes
Copy link
Contributor

We are using resolveCiFriendliesOnly for all our projects with

...
		<version.flatten-maven-plugin>1.2.7</version.flatten-maven-plugin>
...
			<plugin>
				<!-- for https://maven.apache.org/maven-ci-friendly.html -->
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>flatten-maven-plugin</artifactId>
				<version>${version.flatten-maven-plugin}</version>
				<configuration>
					<!-- The flag to indicate if the generated flattened POM shall be set as POM file  -->
					<updatePomFile>true</updatePomFile>
					<flattenMode>resolveCiFriendliesOnly</flattenMode>
				</configuration>
				<executions>
					<execution>
						<id>flatten-resolveCiFriendliesOnly</id>
						<phase>process-resources</phase>
						<goals>
							<goal>flatten</goal>
						</goals>
					</execution>
					<execution>
						<id>flatten-clean</id>
						<phase>clean</phase>
						<goals>
							<goal>clean</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

and the generated .flattened-pom.xml no longer contains any comment.

As the original pom.xml is available in the SourceCodeManagement only (or on some developer locals) most developers are accessing the "pom.xml" by looking in our nexus-repository via maven-pom-editors function.

We have some nice comments in front of some properties, for example

		<!-- https://github.com/spring-projects/spring-framework/releases -->
		<springVersion>5.3.18</springVersion>

but in the nexus (flattened-pom) they are no longer visible.

Would be nice to keep comments during flatten process.

@ca-stefan-cordes
Copy link
Contributor Author

ca-stefan-cordes commented Apr 8, 2022

As the MavenXpp3Writer is used to write the modified content this probably should be handled in core by
changing the MavenXpp3Reader to grab all org.w3c.dom.CharacterData / org.w3c.dom.Comment / org.w3c.dom.Text
store it in the org.apache.maven.model.Model
and write it in the MavenXpp3Writer.

Similar was requested for Properties order: https://issues.apache.org/jira/browse/MNG-6801
Another similar for GenerateReleasePomsPhase is: https://issues.apache.org/jira/browse/MRELEASE-995
And here two very old which were not fixed: https://issues.apache.org/jira/browse/MNG-4 (comment+formatting) and https://issues.apache.org/jira/browse/MNG-1117 (formatting)

ca-stefan-cordes added a commit to c-a-services/flatten-maven-plugin that referenced this issue Apr 8, 2022
ca-stefan-cordes added a commit to c-a-services/flatten-maven-plugin that referenced this issue Apr 8, 2022
ca-stefan-cordes added a commit to c-a-services/flatten-maven-plugin that referenced this issue Apr 11, 2022
@slawekjaranowski slawekjaranowski linked a pull request Aug 7, 2022 that will close this issue
ca-stefan-cordes added a commit to c-a-services/flatten-maven-plugin that referenced this issue Aug 8, 2022
ca-stefan-cordes added a commit to c-a-services/flatten-maven-plugin that referenced this issue Aug 8, 2022
ca-stefan-cordes added a commit to c-a-services/flatten-maven-plugin that referenced this issue Aug 8, 2022
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

Successfully merging a pull request may close this issue.

1 participant