How to create executable JAR for camel-main project

Fat jar with camel-maven-plugin

In Camel 3.10 onwards you can use the camel-maven-plugin to (prepare a fat jar.

Using maven-shade-plugin

You need to use maven-shade-plugin to create executable JAR. Be aware that uber jar is not fully tested feature and it is Your responsibility to ensure all services are fully functional. You might need some modifications, depending on Your project structure.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.2.1</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <shadedArtifactAttached>true</shadedArtifactAttached>
                <shadedClassifierName>executable-jar</shadedClassifierName>
                <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>my.package.MainClass</mainClass>
                    </transformer>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                        <resource>META-INF/services/org/apache/camel/TypeConverterLoader</resource>
                    </transformer>
                </transformers>
            </configuration>
        </execution>
    </executions>
</plugin>