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

Adding Spring Cloud Stream Version To Message Headers For Easier Debugging Of Issues #3027

Closed
wants to merge 3 commits into from

Conversation

omercelikceng
Copy link
Contributor

Resolves #2814

@olegz olegz closed this in a8fb34d Nov 5, 2024
@omercelikceng
Copy link
Contributor Author

Hello @sobychacko. Why did you revert the relevant commit? What’s the issue?

@sobychacko
Copy link
Contributor

Hi @omercelikceng, On our CI environments, we were getting the following error.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:3.1.0:run (readme) on project spring-cloud-stream: An Ant BuildException has occured: Could not find org.springframework.cloud.internal.asciidoctor.ReadmeMain. Make sure you have it in your classpath

[ERROR] around Ant part ...<java classname="org.springframework.cloud.internal.asciidoctor.ReadmeMain" failonerror="yes" classpathref="readme.class.path">... @ 7:132 in /opt/jenkins/data/workspace/spring-cloud-stream-Moorgate-main-openjdk17-ci/core/spring-cloud-stream/target/antrun/build-main.xml

Can you see why we got this error? Looks like you added that antrun plugin as part of this PR.

@omercelikceng
Copy link
Contributor Author

omercelikceng commented Nov 10, 2024

Hi @omercelikceng, On our CI environments, we were getting the following error.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:3.1.0:run (readme) on project spring-cloud-stream: An Ant BuildException has occured: Could not find org.springframework.cloud.internal.asciidoctor.ReadmeMain. Make sure you have it in your classpath

[ERROR] around Ant part ...<java classname="org.springframework.cloud.internal.asciidoctor.ReadmeMain" failonerror="yes" classpathref="readme.class.path">... @ 7:132 in /opt/jenkins/data/workspace/spring-cloud-stream-Moorgate-main-openjdk17-ci/core/spring-cloud-stream/target/antrun/build-main.xml

Can you see why we got this error? Looks like you added that antrun plugin as part of this PR.

Hello @sobychacko, I apologize for the issue you’ve encountered.

I’ve investigated the problem, and it occurs when we build with the "docs" profile.

In the "docs" profile, there are specific configurations defined for the maven-antrun-plugin in the spring-cloud-build project. The Spring Cloud Stream project declares the spring-cloud-build project as its parent POM.

Along with my development, I’ve added custom configurations for the maven-antrun-plugin in the Spring Cloud Stream POM(spring-cloud-stream core). This is exactly where the issue arises.

I haven’t been able to pinpoint the exact cause yet, but I will continue investigating and open a pull request once I have a solution.

I don't know how, but it seems like it is failing to get the correct classpath.
spring-cloud-build pom :

<execution>
	<id>readme</id>
	<phase>${generate-readme.phase}</phase>
	<goals>
            <goal>run</goal>
	</goals>
	<configuration>
            <target>
	        <path id="readme.class.path">
		    <pathelement location="${readme.main.classpath}"/>
	        </path>
	        <java classname="org.springframework.cloud.internal.asciidoctor.ReadmeMain"
				        failonerror="yes" classpathref="${readme.class.path}">
		    <!-- Input -->
		    <arg value="${project.basedir}/src/main/asciidoc/README.adoc"/>
		    <!-- Output -->
		    <arg value="${main.basedir}/README.adoc"/>
	        </java>
            </target>
	</configuration>
</execution>

@omercelikceng
Copy link
Contributor Author

@sobychacko , I reviewed the issue and considered various solutions, but I need your guidance.

Currently, in the spring-cloud-build project, within the docs profile, there are configurations defined for maven-antrun-plugin in the dependencyManagement section. (https://github.com/spring-cloud/spring-cloud-build/blob/main/pom.xml)

In my case, I used maven-antrun-plugin within spring-cloud-stream-core. Since spring-cloud-build is the parent POM for spring-cloud-stream, the phases specified in the docs profile of spring-cloud-build were triggered, leading to errors. Normally, this plugin was not executed. However, because I defined this plugin in the spring-cloud-stream-core POM, it caused all the phases defined in the parent POM(spring-cloud-build) to execute, leading to errors.

Additionally, in the spring-cloud-stream project, the usage of maven-antrun-plugin within the docs profile has been disabled. (https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/pom.xml)

My proposed solution is to set these phases to "none" in spring-cloud-stream-core to prevent the phases defined in spring-cloud-build from running. If this approach is acceptable to you, I will proceed with a pull request.

My solution :

<properties>
      <generate-readme.phase>none</generate-readme.phase>
      <generate-docs.phase>none</generate-docs.phase>
  </properties>

@omercelikceng
Copy link
Contributor Author

Hi, @sobychacko. Can you provide me with some feedback on this? I tested it and confirmed that it works. Should I open a pull request directly?

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 this pull request may close these issues.

Add Spring Cloud Stream version as part of message headers produced
2 participants