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

improve pom #477

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
simple. It is a class library for editing bytecodes in Java.
</description>
<url>https://www.javassist.org/</url>
<inceptionYear>1999</inceptionYear>

<licenses>
<!-- this is the license under which javassist is usually distributed
Expand Down Expand Up @@ -224,13 +225,37 @@
<attach>true</attach>
<excludePackageNames>javassist.compiler:javassist.convert:javassist.scopedpool:javassist.bytecode.stackmap</excludePackageNames>
<bottom><![CDATA[<i>Javassist, a Java-bytecode translator toolkit.<br>
Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.</i>]]></bottom>
Copyright (C) ${project.inceptionYear}- Shigeru Chiba. All Rights Reserved.</i>]]></bottom>
<show>public</show>
<nohelp>true</nohelp>
<doclint>none</doclint>
<source>8</source>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>enforces</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<!-- official docs: https://maven.apache.org/enforcer/enforcer-rules/index.html -->
<requireMavenVersion>
<version>3.2.5</version>
</requireMavenVersion>
<requireJavaVersion>
<version>11</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this consistent with the other parts? The binary is built by Java 8.

Copy link
Contributor Author

@oldratlee oldratlee Dec 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

  • requireJavaVersion enforce the java version to run maven.
    • I found that compile failed with jdk 8 (and test target is 11).
    • Java 21 satisfies requireJavaVersion 11.
  • The bytecode version of binary is controlled by javac target option.

The guarantee that the built binary can be used by java 8 application, is important for foundational libraries(e.g. javassit).

The CI can check this guarantee with some works:

  • build/compile with java 21 or 11(e.g. maven install)
  • run test(without compile) on multiple java versions(e.g. mvn surfire:test)
  • the test cases that can not run by java 8, should be skipped conditionally(by test case/framework config).

I do this(build by java high version and run test by java low versions in CI/GitHub actions) in some projects, e.g. https://github.com/alibaba/transmittable-thread-local/actions/runs/7358077464/job/20030750510#step:7:206

I can try to add this to the CI/GitHub actions of javassist project with honor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that compile failed with jdk 8 (and test target is 11).

This is correct. Some features are only for Java 11 and above.

</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
Expand Down Expand Up @@ -281,6 +306,7 @@ Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.</i>]]></bottom>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<passphrase>${gpg.passphrase}</passphrase>
<useAgent>${gpg.useAgent}</useAgent>
Expand All @@ -300,7 +326,7 @@ Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.</i>]]></bottom>
</profile>
<!-- profiles to add tools jar containing com.sun.jdi code
needed by sample code
-->
-->
<profile>
<id>default-tools</id>
<activation>
Expand Down
Loading