Maven shade plugin relocate file to main folder

I am using maven-shade-plugin version 3.2.1 to include/exclude some classes. I am trying to relocate files inside a folder to main folder in a jar.

<configuration>
        <filters>
                ...
        </filters>
        <relocations>
                <relocation>
                        <pattern>org/example</pattern>
                        <shadedPattern>org/example/example2</shadedPattern>
                </relocation>
        </relocations>
</configuration>

If I use it as above, it moves files under org.example to org.example.example2 (just to make sure it is working). If I use just "/", then it creates folder and subfolder with empty names and places files under them. And nothing happens if i keep </shadedPattern> empty.

I want to place files in the main directory but i am not able to do it so far.

Is there any way to achieve this through shade plugin or with something else?

Thanks

#java #maven #intellij-idea

9 Likes13.85 GEEK