Maven打包指定Main方法

Maven版本3.6.3,quickstart版本1.4,注意这个插件要放在build子标签下,不要放在pluginManagement子标签中

<plugins>
      <plugin>
        <groupId>org.apache.maven.pluginsgroupId>
        <artifactId>maven-shade-pluginartifactId>
        <version>3.2.1version>
        <configuration>
          <createDependencyReducedPom>falsecreateDependencyReducedPom>
        configuration>
        <executions>
          <execution>
            <phase>packagephase>
            <goals>
              <goal>shadegoal>
            goals>
            <configuration>
              <transformers>
                <transformer
                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>com.main.AppmainClass>
                transformer>
              transformers>
            configuration>
          execution>
        executions>
      plugin>
plugins>

你可能感兴趣的:(maven)