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

HHH-18644: New and improved hibernate-maven-plugin #9145

Closed
wants to merge 18 commits into from

Conversation

koentsje
Copy link
Member

@koentsje koentsje commented Oct 23, 2024

  • Change 'hibernate-maven-plugin.gradle' to depend on 'org.apache.maven.shared:file-management:3.1.0'
  • Add the implementation, test and integration test sources for the new hibernate-maven-plugin

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-18644

@koentsje koentsje requested a review from sebersole October 23, 2024 11:28
Copy link
Member

@sebersole sebersole left a comment

Choose a reason for hiding this comment

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

I left a comment about getting information from the Gradle build into the pom file.

We also need to expose your integration testing into the Gradle build. Unless I am missing something, at the moment one would need to directly call Maven to be able to run these integration tests.

required = true)
private boolean enableExtendedEnhancement;

public void execute() {

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
Mojo.execute
; it is advisable to add an Override annotation.
@koentsje koentsje force-pushed the HHH-18644 branch 2 times, most recently from 121be65 to aebae31 Compare November 12, 2024 14:37
@koentsje koentsje force-pushed the HHH-18644 branch 3 times, most recently from dbc438d to ca2e3c5 Compare November 15, 2024 16:47
  - Add MavenInstallTask to install artifacts in local repo
  - Add MavenInvokerRunTask to run the integration tests
  - Integrate both tasks in MavenEmbedderPlugin
  - Add the hibernate-maven-plugin implementation

Signed-off-by: Koen Aers <[email protected]>
  - Add needed dependencies to pom.xml so that the 'mvn invoker:run' invocation does not complain anymore
  - Add dependency on jarkarta persistence to 'it/enhance/pom.xml' so that the project compiles when 'mvn invoker:run' is called

Signed-off-by: Koen Aers <[email protected]>
  - Add plugin installation to MavenInvokerRunTask
  - Remove use of MavenInstallArtifactTask in MavenEmbedderPlugin
  - Use version 7.0.0.Beta1 of hibernate-core for now (to make the integration test work using mvn)
  - Add 'run' goal to the execution of the invoker plugin in pom.xml

Signed-off-by: Koen Aers <[email protected]>
  - Implement the verification script so that it properly verifies that the class enhancement
  - Add a script variable definition to pom.xml for use in the verification script

Signed-off-by: Koen Aers <[email protected]>
  - Add and configure a class 'org.hibernate.build.maven.embedder.logging.Slf4jConfiguration' to be able to have the calls to Maven provide usable logging
  - Add a Maven wrapper executable to the integration test project and configure the Maven invoker plugin to use that executable
  - Add the .mvn folder to .gitignore

Signed-off-by: Koen Aers <[email protected]>
  - Remove the 'tooling/hibernate-maven-plugin/.gitignore'
  - Add Maven wrapper properties

Signed-off-by: Koen Aers <[email protected]>
  - Some cleanup of forgotten System.out.println() statements
  - Removal of unneeded dependencies in pom.xml

Signed-off-by: Koen Aers <[email protected]>
  - Add hibernate-core publication to the local Maven repo
  - Add (incomplete) pom generation for hibernate-maven-plugin

Signed-off-by: Koen Aers <[email protected]>
  - Complete generation of 'pom.xml' in 'tooling/hibernate-maven-plugin/hibernate-maven-plugin.gradle' to include the invoking of the integration tests
  - Cleanup of class 'MavenPluginDescriptorTask'
  - Cleanup of class 'MavenInvokerRunTask'
  - Add possibility to specify path to the pom file in 'MavenInstallArtifactTask'
  - Change the working directory to 'maven-embedder/working-directory' in 'MavenEmbedderPlugin
  - Create a task to copy the pom.xml file (generated by task 'generatePomFileForHibernateCorePublication' to the root of the working directory
  - Create a task to copy the sources to the working directory
  - Create a task to install 'hibernate-scan-jandex' into the local repository
  - Create a task to install the hibernate-maven-plugin into the local repository prior to the integration tests
  - Wire all the tasks together

Signed-off-by: Koen Aers <[email protected]>
  - Remove unneeded 'pom.xml' file
  - Make the 'check' gradle task depend on both 'integrationTest' and 'generatePluginDescriptorTask'

Signed-off-by: Koen Aers <[email protected]>
  - Installing hibernate-core depends on creating the jar
  - Installing hibernate-scan-jandex depends on creating the jar

Signed-off-by: Koen Aers <[email protected]>
  - Use the existing publish tasks in 'MavenEmbedderPlugin'
    * Replace 'generatePomFileForHibernateMavenPluginPublication' by 'generatePomFileForPublishedArtifactsPublication'
    * Replace 'generatePomFileForHibernateCorePublication' with ':hibernate-core:generatePomFileForPublishedArtifactsPublication'
    * Adapt the artifact locations to the changes above
  - Perform some cleanup in 'hibernate-maven-plugin.gradle'
    * Change 'hibernateMavenPlugin' into the already existing 'publishedArtifacts' so that the correct pom.xml file is also published appropriately
    * Remove the 'hibernateCore' publication (since we are now using 'publishedArtifacts' in the MavenEmbedderPlugin)
    * Remove the 'mavenLocal' repository as this is now also handled in the MavenEmbedderPlugin

Signed-off-by: Koen Aers <[email protected]>
  - Add a task to copy the compiled classes into the Maven working directory
  - Remove the compilation step from the descriptor generation task

Signed-off-by: Koen Aers <[email protected]>
  - Fix build problem using 'gradle/publishing-pom.gradle' instead of 'gradle/published-java-module.gradle'

Signed-off-by: Koen Aers <[email protected]>
  - Use the artifact to be installed as an @InputFile in MavenInstallArtifactTask
  - Calculate the artifact name in MavenEmbedderPlugin

Signed-off-by: Koen Aers <[email protected]>
  - Move the copy logic from MavenEmbedderPlugin to hibernate-maven-plugin.gradle

Signed-off-by: Koen Aers <[email protected]>
  - Add a new Gradle task to generate the Maven wrapper and wire it in the build
  - Remove the Maven wrapper files from the checked in sources

Signed-off-by: Koen Aers <[email protected]>
  - Create new gradle task 'RunMavenTask' that can generically execute Maven goals
  - Redefine the instances of MavenInstallArtifactTask, MavenInvokerRunTask and MavenWrapperTask in MavenEmbedderPlugin to use the above RunMavenTask instead
  - Remove the unneeded MavenInstallArtifactTask, MavenInvokerRunTask and MavenWrapperTask classes
  - Use the outcome of the Maven execution to throw an exception if there was an error

Signed-off-by: Koen Aers <[email protected]>
@sebersole
Copy link
Member

Squashed and applied manually. Thanks!

@sebersole sebersole closed this Nov 19, 2024
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.

2 participants