-
Notifications
You must be signed in to change notification settings - Fork 14
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
[MARTIFACT-59] tolerate injected timestamp value #30
base: master
Are you sure you want to change the base?
Conversation
issue moved to https://issues.apache.org/jira/browse/MARTIFACT-59 |
IIUC, it's about not displaying an ERROR message when build run as |
Goal is really to enable the value to be a property from the project but not hardcoded. High level here the issue with current option:
This PR just tries to make last option not emitting a warning. |
I mostly disagree on why fixed value is or not a good idea (and how to do it), but let's take that apart but I agree that some people may prefer to inject last git commit time: please share a project doing that, and what issue m-artifact-p is causing in that case (what you call "not tolerate", which I don't know what are the symptoms): only after, we'll see what to improve. For now, I can't get where this PR is going |
@hboutemy you can check the test, the log.error will be emitted if you use a property instead of a hardcoded value which adds maintenance burden (either force a manual step or to work this outside maven ecosystem which are both not satisfying). So idea is to enable project to set up this property without any downside (log errors or plain error in check mojo). |
I don't see any pom.xml to run any mvn command against: I don't know what the initial symptom is (with which artifact goal, during what type of work) given there is MARTIFACT-54 bug, I'll release with that fix and we'll see later MARTIFACT-59 (please rework your PR: it's not MNG) |
I updated the description, an external reference is yupiik/tools-maven-plugin#12 but long story short it is I thought about your position to say it is wrong to not hardcode it, if this PR is really not an option, I think I could "not care" about it if the value is automatically rewritten by a plugin. Would it be better for you? |
thanks: it's the first step into describing: then what is the symptom? what happens when you do that, that you want to change?
what I say is that using git commit is not the most efficient, because it changes on each commit even if the jar file content does not really change: then it forces jar update only for timestamp. Having a value hard coded + maven-release-plugin and versions-maven-plugin update/rewrite when version is updated is the most efficient strategy found so far: I know it's not a usual strategy, but it never creates a different jar when it is not necessary because its content has really changed. But I don't fight hard against people wanting to use git commit: from a theoretical perspective, I understand it looks more natural. If you want to go that route, no problem. If you experience a problem maven-artifact-plugin, I just need to see what concrete problem is caused by what goal of maven-artifact-plugin for you when doing that strategy, to understand how to update the code to precisely detect that case and not have unintended side effects. FYI, moditect uses the git commit strategy and there is no issue for them: https://github.com/moditect/moditect => https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/moditect/moditect/README.md |
I almost more than agree with that except the first parth. Now (v4) we have a root pom we can enforce to define it in the root pom for the whole project too. Side note: I don't care much if we stay in the status quo for v3, it kind of works.
Cause they don't use any of artifact plugin nor use it in the root pom otherwise it is there for them too ;). So overall more I think to it more I agree with you we do it wrong and should make it immutable - we should make it immutable ;) - and in maven core - there is no way it works reliably in any plugin by design and it is shared anyway by all plugins and maven properties - thinking to injected metadata in artifacts with filtering. So my proposal would be:
wdyt? |
wrong, they use everything, and it works: I still don't get what needs to be changed in maven-artifact-plugin
this proposal is not in the hands of the maven-artifact-plugin, but Maven 5 (new element in |
wrong (ok was cause it made me smile to read it) please just run
Which is not a "it works as expected" behavior for me. My setup with git-commit-id works similarly but a warning in the build is just a sign it is buggy by design and there it is technically justifiable too. Now, as mentionned, run
and a nice
which breaks the build. So no, it does not work for them. |
we're starting a little progression because now we have a concrete example to run against, instead of just speaking on https://github.com/moditect/moditect.git, |
@hboutemy not sure what you tried to explain but maven-artifact-plugin 3.5.1 behaves 100% the same so no step forward. Your commit does not change the behavior when build the whole project, even the change after which moves to the session does not change that so it still does not work for the referenced projects. |
I could play and just say that your experience is wrong and mine right, but this would not help... |
I would be happy if true but what did you do different from me? Also code is more on my side than yours for now - see this PR for details - so I don't understand what you're trying to say for now. |
I don't know what you did, you talked but did not share any output. I ran check-buildplan against latest release of moditect for 3.5.0 and 3.5.1: see https://gist.github.com/hboutemy/cca5a94c6f7a9bc65023a31c31d3308f
this code does some magic about "injecting": I don't know what injecting means, from unit test, I don't get what CLI command it is related to: |
You have the same error than me.
This kind of injected (=interpolated) value just fails exactly the same than moditech in your example on both commands (first exit with status=0 but logs an error which is wrong and second just fails). |
there are 2 runs, look at the first one: no problem with 3.5.1, same problem with 3.5.0
the unit test does not have any pom.xml: it's hard to guess what the code tries to represent from an end-user point of view |
Hmm, not sure what which artifact you used built but got back the plugin from asf repo and still getting the same error: https://gist.github.com/rmannibucau/816c07cd6277e602584d0bb2b4497c5a#file-output-txt-L29 If it helps:
assuming it is ambiguous: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.rmannibucau.test</groupId>
<artifactId>foo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<!-- this is what this PR was fixing by validating at eval time the presence of the property and not at model loading time -->
<project.build.outputTimestamp>${git.commit.time}</project.build.outputTimestamp>
</properties>
<!-- git-commit-id-plugin in initialize phase since there is nothing much before that phase for a maven build from plugins -->
</project> |
yours: |
@hboutemy ok, so 1.2.1 is using a hardcoded value - so out of scope of this PR - and 1.3.0-SNAPSHOT does use a placeholder (this PR case). |
No description provided.