Skip to content

Instantly share code, notes, and snippets.

@Da9el00
Last active April 29, 2024 14:44
Show Gist options
  • Save Da9el00/df8efbc8de53cd39463c05cbeb0503d3 to your computer and use it in GitHub Desktop.
Save Da9el00/df8efbc8de53cd39463c05cbeb0503d3 to your computer and use it in GitHub Desktop.
Plugin to make JavaFX executable jar with Maven
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>Your_main_class_here</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
@hamah-tech
Copy link

I get the message: Cannot resolve plugin org.apache.maven.plugins:maven-shade-plugin:
How can I solve the problem?

@Da9el00
Copy link
Author

Da9el00 commented May 31, 2021

I get the message: Cannot resolve plugin org.apache.maven.plugins:maven-shade-plugin:
How can I solve the problem?

This is my best idea:
Run a force re-import from the maven tool window. If that does not work, you could try to Invalidate your caches (File -> Invalidate caches) and restart. I think this is a problem with the plugin not being loaded correctly, so a restart and reload might do the trick.

@EpicConOwO
Copy link

EpicConOwO commented Mar 11, 2022

i did some digging, for me the problem was "version" tag was missing, adding version tag fixed the issue for me.

<plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-shade-plugin</artifactId>
               <version>3.2.4</version>
               <executions>
                   <execution>
                       <goals>
                           <goal>shade</goal>
                       </goals>
                       <configuration>
                           <shadedArtifactAttached>true</shadedArtifactAttached>
                           <transformers>
                               <transformer implementation=
                                                    "org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                   <mainClass>com.game.hangman.Main</mainClass>
                               </transformer>
                           </transformers>
                       </configuration>
                   </execution>
               </executions>
           </plugin>

.

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