-
Notifications
You must be signed in to change notification settings - Fork 155
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
[ARCHETYPE-584] fix indentation in root pom.xml #35
base: master
Are you sure you want to change the base?
Conversation
Any chance to get this PR merged? |
|
||
out = new StringWriter(); | ||
StringWriter out = new StringWriter(); |
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.
Looks like this could be a field that doesn't need to be initialized in each method.
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.
Moved to setup method.
@@ -61,6 +61,17 @@ | |||
public class ArchetypeTest | |||
extends PlexusTestCase | |||
{ | |||
private static final String XML_VERSION_1_0 = |
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.
splitting out these constants makes the tests harder for me to read. I prefer having all the expected content directly in each method, even at the expense of some duplication.
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.
Funny how different people read code. I could barley make any sense out of the initial version. Is revert in the new commit.
Any progress on this PR? |
|
||
private OldArchetype archetype; | ||
|
||
private StringWriter out; |
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.
initialize this here
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.
ping
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.
It is initialized in the setup method. If I init it here it would be done twice. If I remove it from the setup the tests would share state.
Or do I miss something here?
Btw if any maintainer really wants it to be changed, please fell free to do so. Whatever works best, I am fine with it.
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.
Yes, you're missing something. Tests do not share instance variables. Every test is run with a new object.
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.
|
||
StringWriter out = new StringWriter(); | ||
out = new StringWriter(); |
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.
you don't need to initialize this in the test
|
||
StringWriter out = new StringWriter(); | ||
out = new StringWriter(); |
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.
you don't need to initialize this in the test
|
||
StringWriter out = new StringWriter(); | ||
out = new StringWriter(); |
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.
you don't need to initialize this in the test
|
||
StringWriter out = new StringWriter(); | ||
out = new StringWriter(); |
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.
you don't need to initialize this in the test
|
||
StringWriter out = new StringWriter(); | ||
out = new StringWriter(); |
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.
you don't need to initialize this in the test
|
||
StringWriter out = new StringWriter(); | ||
out = new StringWriter(); |
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.
you don't need to initialize this in the test
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.
You are absolutly right. Fixed all occurances.
@@ -453,5 +489,6 @@ protected void setUp() | |||
{ | |||
super.setUp(); | |||
archetype = (OldArchetype) lookup( OldArchetype.ROLE ); | |||
out = new StringWriter(); |
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.
setUp method usually goes near the top
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 kept the method where it was before my patch. I think that keeps reviewing changes easier.
While I personally also prefer it at the top, there is another class which has it after the test, so I assume this is somehow an intended style.
Updated the branch |
@elharo is this ok now to merge, or do you think something additional is required? |
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.
Just one nit remaining but atm I don't see anything blocking
|
||
private OldArchetype archetype; | ||
|
||
private StringWriter out; |
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.
ping
can't merge, there are 4 ITs failing: https://builds.apache.org/blue/organizations/jenkins/maven-box%2Fmaven-archetype/detail/ARCHETYPE-584/14/pipeline :( |
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.
IT failures look real. I'm guessing that the golden data needs to be updated to match the output after this PR:
[ERROR] The following builds failed:
[ERROR] * ARCHETYPE-241_filter-directory/pom.xml
[ERROR] * ARCHETYPE-536_groovy-grape/pom.xml
[ERROR] * roundtrip-multi/pom.xml
[ERROR] * build-and-run-its/pom.xml
How does one update the golden data then ? This PR has gone stale but seems really only this last hurdle is missing. |
Wow, this branch/bug is still around. I totally forgot about it. After playing around with the integration tests a bit, one problem was to load the Let's see what comes up next or if this long journey reaches its happy end. :) |
@@ -79,6 +83,13 @@ public static boolean addNewModule( String artifactId, Reader fileReader, Writer | |||
dbf.setXIncludeAware( false ); | |||
dbf.setExpandEntityReferences( false ); | |||
|
|||
InputStream inputStream = PomUtils.class.getClassLoader().getResourceAsStream( "maven-4.0.0.xsd" ); |
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 is the purpose of loading this schema?
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.
Please see my minimal, reproducible example here https://issues.apache.org/jira/browse/ARCHETYPE-584?focusedCommentId=17008264&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17008264
I investigated this 1.5 years ago and cannot remember the details why it only worked this way. However, I am pretty sure that I did not dive into the implementation details of DocumentBuilderFactory
, which is fed with the schema
, so not sure if I would have been able to explain it very deep back then.
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.
My guess is that you don't need the schema to fix this bug. In fact, you probably only need setIgnoringElementContentWhitespace
though setNamespaceAware( true )
is always a good idea.
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.
Please check the example I provided. When you run it, you will see that without the schema the output is not as expected.
@@ -0,0 +1,2246 @@ | |||
<?xml version="1.0"?> |
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.
strange that this has to be copied into this project. I'd expect it to be loaded from maven core, if at all.
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.
Feel free to point me to location of the xsd
in maven core or any other way to load it and I happily update the PR.
archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java
Show resolved
Hide resolved
I committed a new attempt to get this merged. Since I do not understand which solution is acceptable, I made an unclean commit (code in comments, no proper exception handling). |
I think this is superseded by #128 |
I think so too and would love to try it out @kwin. Unfortunately maven-archetype-plugin version 3.3.0 is not released, yet. Any estimated time when the release will happen? Or any way to test this, besides building the plugin locally? |
Problem: linebreaks + indentions (whitespaces) are read as actual document nodes. This causes problems in combination with
Removed the
.normalizeWhitespace()
in tests, because this shadowed the actual bug. Also split one test into multiple tests. Test content remains the same.Had to add the maven-4.0.0.xsd, not sure if this is desired.