GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — spotless maven eclipse jdt - How to block import star (*) wildcard? · Issue #832 · diffplug/spotless

spotless maven eclipse jdt - How to block import star (*) wildcard? #832

New issue
Copy link
New issue
Copy link
Closed
#2517
Closed
spotless maven eclipse jdt - How to block import star (*) wildcard?#832
#2517
Copy link
Labels
question

Description

@tivrfoa
tivrfoa
opened on Apr 6, 2021
Issue body actions

Hi!

Spotless is really cool project!

I am using maven plugin with eclipse jdt.

Is there a way to block import package.*; please?

I think there is no way (currently) to remove package.* and put the correct imports, but I would like to at least it to give an error, so the developer can fix it.

Thank you!! :)

Activity

  1. smoothreggae commented on Apr 6, 2021

    @smoothreggae
    smoothreggae
    on Apr 6, 2021
    More actions

    This sounds similar to #649. One of the comments has something you could try as an alternative.

    Reacted by Ned Twigg and tivrfoa
  2. nedtwigg
    added
    question
    on Apr 6, 2021
  3. nedtwigg commented on Apr 6, 2021

    @nedtwigg
    nedtwigg
    on Apr 6, 2021
    Member
    More actions

    Thanks @smoothreggae!

  4. nedtwigg
    closed this as completedon Apr 6, 2021
  5. tivrfoa commented on Apr 6, 2021

    @tivrfoa
    tivrfoa
    on Apr 6, 2021
    Author
    More actions

    This sounds similar to #649. One of the comments has something you could try as an alternative.

    UPDATE! It worked. Sorry the noise!
    The correct location is in fact inside <java>
    disregard the text below

    Thank you!

    Where should the code below be placed in pom.xml please?

                  <replaceRegex>
                    <name>Remove wildcard imports</name>
                    <searchRegex>import\s+[^\*\s]+\*;(\r\n|\r|\n)</searchRegex>
                    <replacement>$1</replacement>
                  </replaceRegex>

    I placed inside <java></java>, but mvn spotless:check didn't spot it :]
    I'm using spotless version 2.4.1

    					<java>
    						<importOrder>
    							<order>br,com,java,javax,org,</order>
    						</importOrder>
    						<removeUnusedImports />
    						<replaceRegex>
    								<name>Remove wildcard imports</name>
    								<searchRegex>import\s+[^\*\s]+\*;(\r\n|\r|\n)</searchRegex>
    								<replacement>$1</replacement>
    							</replaceRegex>
    						<eclipse>
    							<version>4.13.0</version>
    							<file>${basedir}/eclipse-formatter.xml</file>
    						</eclipse>
    					</java>
  6. tivrfoa commented on Apr 6, 2021

    @tivrfoa
    tivrfoa
    on Apr 6, 2021
    Author
    More actions

    I updated the text. It worked! Thanks again!

  7. nedtwigg commented on Jul 7, 2025

    @nedtwigg
    nedtwigg
    on Jul 7, 2025
    Member
    More actions

    Released in plugin-gradle 7.1.0 and plugin-maven 2.45.0.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.