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

feat: maven rockcraft plugin #728

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft

Conversation

vpa1977
Copy link
Contributor

@vpa1977 vpa1977 commented Oct 8, 2024

Add overrides for craft-part maven plugin to allow building Maven projects in rockcraft.

Namely:

  • Do not link /bin/java as it conflicts with the base-files_base slice

The PR requires canonical/craft-parts#895

  • Have you signed the CLA?

Add overrides for craft-part maven plugin to allow
building Maven projects in rockcraft.

Namely:
 - Do not link /bin/java as it conflicts with the base-files_base slice
 - Restrict PATH to /usr/bin in order to avoid picking up unwanted JVM.
   Use can override PATH in the plugin environment settings if /usr/bin
   is not sufficient.
@vpa1977
Copy link
Contributor Author

vpa1977 commented Oct 9, 2024

Needs ci retry for lint task: /home/runner/work/rockcraft/rockcraft/docs/reuse/tutorial/setup.rst:1: WARNING: broken link: https://multipass.run/docs/how-to-install-multipass (500 Server Error: for url: https://multipass.run/docs/how-to-install-multipass)

@vpa1977 vpa1977 marked this pull request as ready for review October 9, 2024 03:58
Maven plugin is overriden in rockcraft.
Add rockcraft-specific instructions for the plugin.
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 13, 2024
@vpa1977 vpa1977 requested a review from lengau October 13, 2024 19:40
@vpa1977
Copy link
Contributor Author

vpa1977 commented Oct 13, 2024

Note: linter exception in the logs is resolved by #732

@lengau lengau requested a review from tigarmo October 15, 2024 20:39
rockcraft/plugins/maven_plugin.py Outdated Show resolved Hide resolved
rockcraft/plugins/maven_plugin.py Show resolved Hide resolved
tests/spread/rockcraft/plugin-maven/rockcraft.yaml Outdated Show resolved Hide resolved
Copy link
Collaborator

@tigarmo tigarmo left a comment

Choose a reason for hiding this comment

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

@vpa1977 thanks for the PR. The main thing that's blocking me here is that the spread test project builds fine for me without the changes, which is weird because I've seen the issues that your code aims to fix in the past too.

Since you've worked with this plugin more recently, do you know of a project that would definitely not work without this rockcraft-custom plugin?

rockcraft/plugins/maven_plugin.py Outdated Show resolved Hide resolved
tests/spread/rockcraft/plugin-maven/rockcraft.yaml Outdated Show resolved Hide resolved
tests/spread/rockcraft/plugin-maven/rockcraft.yaml Outdated Show resolved Hide resolved
rockcraft/plugins/maven_plugin.py Outdated Show resolved Hide resolved
@vpa1977
Copy link
Contributor Author

vpa1977 commented Oct 22, 2024

@vpa1977 thanks for the PR. The main thing that's blocking me here is that the spread test project builds fine for me without the changes, which is weird because I've seen the issues that your code aims to fix in the past too.

Since you've worked with this plugin more recently, do you know of a project that would definitely not work without this rockcraft-custom plugin?

Please refer to CI run https://github.com/canonical/rockcraft/actions/runs/11447589661/job/31850127130?pr=738 of #738. This draft PR adds only test and it fails building maven project second time.

Do not touch path,  just put /usr/bin as a priority
@vpa1977 vpa1977 requested a review from tigarmo October 22, 2024 08:26
@tigarmo
Copy link
Collaborator

tigarmo commented Oct 22, 2024

@vpa1977 thanks for the PR. The main thing that's blocking me here is that the spread test project builds fine for me without the changes, which is weird because I've seen the issues that your code aims to fix in the past too.
Since you've worked with this plugin more recently, do you know of a project that would definitely not work without this rockcraft-custom plugin?

Please refer to CI run https://github.com/canonical/rockcraft/actions/runs/11447589661/job/31850127130?pr=738 of #738. This draft PR adds only test and it fails building maven project second time.

Ah I see, I missed the part where the second execution of rockcraft pack was the one that failed. Thanks

@vpa1977 vpa1977 requested a review from tigarmo October 23, 2024 05:01
This reverts commit bb08f27.

Chisel slices do not install /usr/bin symlink as it will cause
conflicts between different versions of jre slices.
@vpa1977
Copy link
Contributor Author

vpa1977 commented Nov 6, 2024

As discussed during sprint, I am dropping part that restricts the path and will provide the fix as PR in for craft-parts to set the JAVA_HOME.
This PR will remove hardlink part which will make the maven plugin usable with rockcraft.

build-packages:
- maven
- openjdk-21-jdk-headless
# replace chiselled image modules with jlink output
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you explain to me how this override-build is "replacing" the chiseled content with the jlink output? Wouldn't the cp command just "add" the jlink files to the existing files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Notice:

    stage-packages:
     - openjdk-21-jre-headless_core

This adds ${CRAFT_PART_INSTALL}/usr/lib/jvm/java-21-openjdk-${CRAFT_ARCH_BUILD_FOR} as far as I understand.
cp out/lib/modules ${CRAFT_PART_INSTALL}/usr/lib/jvm/java-21-openjdk-${CRAFT_ARCH_BUILD_FOR}/lib
replaces the module file with the one generated by jlink.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah I see, yes you're right

❯ ls -lah root/usr/lib/jvm/java-21-openjdk-amd64/lib/
total 135M
drwxr-xr-x 3 tiago tiago 4,0K nov 14 08:51 .
drwxr-xr-x 5 tiago tiago 4,0K nov 14 08:51 ..
-rwxr-xr-x 1 tiago tiago  15K nov 14 08:51 jexec
-rwxr-xr-x 1 tiago tiago  19K nov 14 08:51 jspawnhelper
lrwxrwxrwx 1 tiago tiago   34 nov 14 08:51 jvm.cfg -> /etc/java-21-openjdk/jvm-amd64.cfg
-rw-r--r-- 1 tiago tiago  17K nov 14 08:51 libextnet.so
-rw-r--r-- 1 tiago tiago 178K nov 14 08:51 libjava.so
-rw-r--r-- 1 tiago tiago  39K nov 14 08:51 libjimage.so
-rw-r--r-- 1 tiago tiago  77K nov 14 08:51 libjli.so
-rw-r--r-- 1 tiago tiago  17K nov 14 08:51 libjsig.so
-rw-r--r-- 1 tiago tiago  65K nov 14 08:51 libnet.so
-rw-r--r-- 1 tiago tiago 108K nov 14 08:51 libnio.so
-rw-r--r-- 1 tiago tiago  63K nov 14 08:51 libverify.so
-rw-r--r-- 1 tiago tiago  45K nov 14 08:51 libzip.so
-rw-r--r-- 1 tiago tiago 135M nov 14 08:51 modules
drwxr-xr-x 2 tiago tiago 4,0K nov 14 08:51 server
-rw-r--r-- 1 tiago tiago 102K nov 14 08:51 tzdb.dat

@vpa1977
Copy link
Contributor Author

vpa1977 commented Nov 12, 2024

Moving this one to draft as it depends on JAVA_HOME PR in craft parts

@vpa1977 vpa1977 marked this pull request as draft November 12, 2024 19:48
@tigarmo
Copy link
Collaborator

tigarmo commented Nov 14, 2024

Moving this one to draft as it depends on JAVA_HOME PR in craft parts

since this is going back to Draft, can you update the requirements*txt files to point to the craft-parts branch? Then when we merge and release that PR we can update this one with the new craft-parts version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants