You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/12/30 07:56:21 UTC
[GitHub] [maven-enforcer] psiroky opened a new pull request, #213: [MENFORCER-445] Include JAVA_HOME location in the Java rule failure messages
psiroky opened a new pull request, #213:
URL: https://github.com/apache/maven-enforcer/pull/213
Following this checklist to help us incorporate your
contribution quickly and easily:
- [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MENFORCER) filed
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
- [x] Each commit in the pull request should have a meaningful subject line and body.
- [x] Format the pull request title like `[MENFORCER-XXX] - Fixes bug in ApproximateQuantiles`,
where you replace `MENFORCER-XXX` with the appropriate JIRA issue. Best practice
is to use the JIRA issue title in the pull request title and in the first line of the
commit message.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will
be performed on your pull request automatically.
- [x] You have run the integration tests successfully (`mvn -Prun-its clean verify`).
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [x] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-enforcer] psiroky commented on a diff in pull request #213: [MENFORCER-445] Include JAVA_HOME location in the Java rule failure messages
Posted by GitBox <gi...@apache.org>.
psiroky commented on code in PR #213:
URL: https://github.com/apache/maven-enforcer/pull/213#discussion_r1059280557
##########
enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireJavaVendor.java:
##########
@@ -56,25 +54,33 @@ public void matchingInclude() throws EnforcerRuleException {
}
@Test
- public void nonMatchingInclude() {
+ void nonMatchingInclude() {
// Set the included vendor to something irrelevant
underTest.setIncludes(Collections.singletonList(NON_MATCHING_VENDOR));
final EnforcerRuleHelper helper = EnforcerTestUtils.getHelper();
- EnforcerRuleException e = assertThrows(EnforcerRuleException.class, () -> underTest.execute(helper));
- assertThat(e.getMessage(), is(SystemUtils.JAVA_VENDOR + " is not an included Required Java Vendor"));
+
+ assertThatThrownBy(() -> underTest.execute(helper))
+ .isInstanceOf(EnforcerRuleException.class)
+ .hasMessage(
+ "%s is not an included Required Java Vendor (JAVA_HOME=%s)",
+ SystemUtils.JAVA_VENDOR, SystemUtils.JAVA_HOME);
Review Comment:
I replaced the exception assserts with AssertJ since I find those much easier to read and understand (and I noticed the project uses asserj elsewhere as well).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-enforcer] psiroky commented on a diff in pull request #213: [MENFORCER-445] Include JAVA_HOME location in the Java rule failure messages
Posted by GitBox <gi...@apache.org>.
psiroky commented on code in PR #213:
URL: https://github.com/apache/maven-enforcer/pull/213#discussion_r1059372306
##########
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireJavaVersion.java:
##########
@@ -76,6 +76,7 @@ public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException {
+ " Build: " + detectedJdkVersion.getBuildNumber() + " Qualifier: "
+ detectedJdkVersion.getQualifier());
+ super.setMessage(prepareMessage(detectedJdkVersion, getVersion()));
Review Comment:
Hmm. So would it make sense to override the message only if it has not been provided by the rule configuration? Otherwise I am not sure how else would we get the additional info in.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-enforcer] slawekjaranowski commented on a diff in pull request #213: [MENFORCER-445] Include JAVA_HOME location in the Java rule failure messages
Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on code in PR #213:
URL: https://github.com/apache/maven-enforcer/pull/213#discussion_r1059370417
##########
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireJavaVersion.java:
##########
@@ -76,6 +76,7 @@ public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException {
+ " Build: " + detectedJdkVersion.getBuildNumber() + " Qualifier: "
+ detectedJdkVersion.getQualifier());
+ super.setMessage(prepareMessage(detectedJdkVersion, getVersion()));
Review Comment:
We override message which can be provided by rule configuration - is it intentionally?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-enforcer] slawekjaranowski commented on a diff in pull request #213: [MENFORCER-445] Include JAVA_HOME location in the Java rule failure messages
Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on code in PR #213:
URL: https://github.com/apache/maven-enforcer/pull/213#discussion_r1059381501
##########
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireJavaVersion.java:
##########
@@ -76,6 +76,7 @@ public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException {
+ " Build: " + detectedJdkVersion.getBuildNumber() + " Qualifier: "
+ detectedJdkVersion.getQualifier());
+ super.setMessage(prepareMessage(detectedJdkVersion, getVersion()));
Review Comment:
simply set if current message is null
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-enforcer] psiroky commented on a diff in pull request #213: [MENFORCER-445] Include JAVA_HOME location in the Java rule failure messages
Posted by GitBox <gi...@apache.org>.
psiroky commented on code in PR #213:
URL: https://github.com/apache/maven-enforcer/pull/213#discussion_r1059372306
##########
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireJavaVersion.java:
##########
@@ -76,6 +76,7 @@ public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException {
+ " Build: " + detectedJdkVersion.getBuildNumber() + " Qualifier: "
+ detectedJdkVersion.getQualifier());
+ super.setMessage(prepareMessage(detectedJdkVersion, getVersion()));
Review Comment:
No, definitely not intentional. Just and oversight.
Would it make sense to override the message only if it has not been provided by the rule configuration? Otherwise I am not sure how else would we get the additional info in.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-enforcer] slawekjaranowski merged pull request #213: [MENFORCER-445] Include JAVA_HOME location in the Java rule failure messages
Posted by GitBox <gi...@apache.org>.
slawekjaranowski merged PR #213:
URL: https://github.com/apache/maven-enforcer/pull/213
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-enforcer] psiroky commented on a diff in pull request #213: [MENFORCER-445] Include JAVA_HOME location in the Java rule failure messages
Posted by GitBox <gi...@apache.org>.
psiroky commented on code in PR #213:
URL: https://github.com/apache/maven-enforcer/pull/213#discussion_r1059280780
##########
enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireJavaVersion.java:
##########
@@ -89,30 +88,36 @@ void settingsTheJavaVersionAsNormalizedVersionShouldNotFail() throws EnforcerRul
@Test
void excludingTheCurrentJavaVersionViaRangeThisShouldFailWithException() {
- assertThrows(EnforcerRuleException.class, () -> {
- String thisVersion = RequireJavaVersion.normalizeJDKVersion(SystemUtils.JAVA_VERSION);
-
- RequireJavaVersion rule = new RequireJavaVersion();
- // exclude this version
- rule.setVersion("(" + thisVersion);
-
- EnforcerRuleHelper helper = EnforcerTestUtils.getHelper();
- rule.execute(helper);
- // intentionally no assertThat(...) because we expect and exception.
- });
- // intentionally no assertThat(...) because we expect and exception.
+ String thisVersion = RequireJavaVersion.normalizeJDKVersion(SystemUtils.JAVA_VERSION);
+ String requiredVersion = "(" + thisVersion;
+
+ assertThatThrownBy(() -> {
+ RequireJavaVersion rule = new RequireJavaVersion();
+ rule.setVersion(requiredVersion);
+
+ EnforcerRuleHelper helper = EnforcerTestUtils.getHelper();
+ rule.execute(helper);
+ })
+ .isInstanceOf(EnforcerRuleException.class)
+ .hasMessage("The requested JDK version %s is invalid.", requiredVersion);
}
@Test
- @Disabled
- // TODO: Think about the intention of this test? What should it prove?
- void thisShouldNotCrash() throws EnforcerRuleException {
- RequireJavaVersion rule = new RequireJavaVersion();
- rule.setVersion(SystemUtils.JAVA_VERSION);
-
- EnforcerRuleHelper helper = EnforcerTestUtils.getHelper();
- rule.execute(helper);
- // intentionally no assertThat(...) because we don't expect and exception.
Review Comment:
This test has been disabled for years now and as far as I can tell it is not really testing anything that is not being already tested elsewhere, so I figured we should just delete it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-enforcer] psiroky commented on a diff in pull request #213: [MENFORCER-445] Include JAVA_HOME location in the Java rule failure messages
Posted by GitBox <gi...@apache.org>.
psiroky commented on code in PR #213:
URL: https://github.com/apache/maven-enforcer/pull/213#discussion_r1059372306
##########
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireJavaVersion.java:
##########
@@ -76,6 +76,7 @@ public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException {
+ " Build: " + detectedJdkVersion.getBuildNumber() + " Qualifier: "
+ detectedJdkVersion.getQualifier());
+ super.setMessage(prepareMessage(detectedJdkVersion, getVersion()));
Review Comment:
Hmm. So would it make sense to override the message only if it has been not provided by the rule configuration? Otherwise I am not sure how else would be get the additional info in.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-enforcer] psiroky commented on a diff in pull request #213: [MENFORCER-445] Include JAVA_HOME location in the Java rule failure messages
Posted by GitBox <gi...@apache.org>.
psiroky commented on code in PR #213:
URL: https://github.com/apache/maven-enforcer/pull/213#discussion_r1059372306
##########
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireJavaVersion.java:
##########
@@ -76,6 +76,7 @@ public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException {
+ " Build: " + detectedJdkVersion.getBuildNumber() + " Qualifier: "
+ detectedJdkVersion.getQualifier());
+ super.setMessage(prepareMessage(detectedJdkVersion, getVersion()));
Review Comment:
Hmm. So would it make sense to override the message only if it has not been provided by the rule configuration? Otherwise I am not sure how else would be get the additional info in.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org