Skip to content

fix: expandWildcardImports support pom type dependency, fix #2839#2935

Open
tavori wants to merge 1 commit into
diffplug:mainfrom
tavori:feature-maven-expand-wildcard-import
Open

fix: expandWildcardImports support pom type dependency, fix #2839#2935
tavori wants to merge 1 commit into
diffplug:mainfrom
tavori:feature-maven-expand-wildcard-import

Conversation

@tavori
Copy link
Copy Markdown
Contributor

@tavori tavori commented May 19, 2026

fix #2839

  • a summary of the change
  • either
    • a link to the issue you are resolving (for small changes)
    • a link to the PR you just created (for big changes likely to have discussion)

Copy link
Copy Markdown

@Pankraz76 Pankraz76 left a comment

Choose a reason for hiding this comment

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

well done thanks it looks nice.

could be boiled down using string block feature """.

Comment on lines +283 to +286
byte[] bytes = Resources.toByteArray(ResourceHarness.class.getResource("/" + resourcePath));
Path target = newFile(targetName).toPath();
Files.createDirectories(target.getParent());
Files.write(target, bytes);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
byte[] bytes = Resources.toByteArray(ResourceHarness.class.getResource("/" + resourcePath));
Path target = newFile(targetName).toPath();
Files.createDirectories(target.getParent());
Files.write(target, bytes);
Path target = newFile(targetName).toPath();
Files.createDirectories(target.getParent());
Files.write(target, Resources.toByteArray(ResourceHarness.class.getResource("/" + resourcePath)));

why declaring a field maximum far away from its actual usage imposing a coupling burden?

private void writePomWithProjectDeps(String spotlessConfig, String projectDependencies) throws Exception {
String spotlessVersion = System.getProperty("spotlessMavenPluginVersion");
String pomContent =
"<project xmlns=\"http://maven.apache.org/POM/4.0.0\" " +
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

please use string block """ avoiding all this extra extra extra.

setupLocalMavenRepo();

String projectDeps =
" <dependency>\n" +
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

string block """ see comment blow.

setupLocalMavenRepo();

String projectDeps =
" <dependency>\n" +
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

string block """ see comment blow.

" <artifactId>test-dependencies</artifactId>\n" +
" <version>1.0.0</version>\n" +
" <type>pom</type>\n" +
" </dependency>\n";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

string block """ see comment blow.

" <groupId>com.example</groupId>\n" +
" <artifactId>test-annotation-lib</artifactId>\n" +
" <version>1.0.0</version>\n" +
" </dependency>\n";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

string block """ see comment blow.

" <groupId>tmp</groupId>\n" +
" <artifactId>tmp</artifactId>\n" +
" <version>1.0</version>\n" +
"</project>\n");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

string block """ see comment blow.

" <version>1.0.0</version>\n" +
" </dependency>\n" +
" </dependencies>\n" +
"</project>\n";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

string block """ see comment blow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IllegalStateException with expandWildcardImports enabled

2 participants