-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
Maven: Add configuration plugin/pluginManagement #361
Conversation
Codecov Report
@@ Coverage Diff @@
## main #361 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 538 550 +12
===========================================
Files 93 93
Lines 1733 1777 +44
Branches 36 37 +1
===========================================
+ Hits 1733 1777 +44
Continue to review full report at Codecov.
|
src/main/java/tech/jhipster/lite/generator/buildtool/maven/domain/Maven.java
Show resolved
Hide resolved
@Test | ||
void shouldGetPluginWithAdditionalElements() { | ||
// @formatter:off | ||
String expected = "<plugin>" + System.lineSeparator() + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use text block ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Still we need to add a replaceAll("\n", System.lineSeparator())
to keep it OS friendly as Line endings in text blocks are always \n
Plugin plugin = fullPluginBuilder() | ||
.additionalElements( | ||
""" | ||
<executions> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe try to respect indent with 2 spaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you suggest to indent the text block?
another missing: you need to add the method in buildToolDomainService too |
Thanks for pointing it out, added it. |
plugin | ||
.getAdditionalElements() | ||
.ifPresent(additionalElements -> | ||
result.append(plugin.getAdditionalElements().get().indent(4 * indentation).replaceAll("\n", System.lineSeparator())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened if the initial text already contains \r\n? Will it become \r\r\n?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if I understand well, text block with windows always use \n as Line separator ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not just in windows, as per https://docs.oracle.com/en/java/javase/15/text-blocks/index.html#normalization-of-line-terminators , any line endings will become \n in a text block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would help to generate the code as per user's system line endings (in case jhipster-lite is generating on user's local)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok thanks for explaination :)
Just to know, which OS do you use ?
I'm using Linux Ubuntu so it's hard for me to test Windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using Windows 10 as of now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect! so I'm totally trusting you for Windows part!
</includes> | ||
</resource> | ||
</webResources> | ||
</plugin>""".replaceAll("\n", System.lineSeparator()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about existing \r\n which could become \r\r\n
src/test/java/tech/jhipster/lite/generator/buildtool/maven/domain/maven/MavenTest.java
Outdated
Show resolved
Hide resolved
src/test/java/tech/jhipster/lite/generator/buildtool/maven/domain/maven/MavenTest.java
Outdated
Show resolved
Hide resolved
src/test/java/tech/jhipster/lite/generator/buildtool/maven/domain/maven/MavenTest.java
Outdated
Show resolved
Hide resolved
src/test/java/tech/jhipster/lite/generator/buildtool/maven/domain/maven/MavenTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Pascal Grimaud <pascalgrimaud@gmail.com>
Thanks for the review and merge :) |
Big thanks to you, for helping this project! |
Pre-requisite for #284