zoukankan      html  css  js  c++  java
  • maven打可执行jar包

    使用场景:我们用maven打的jar包,是可以通过java -jar执行的,但是不是spring的项目,所以需要自己配置maven来满足使用需要.通过以下配置就可以解决错误信息.

      <build>
            <!--<finalName>ocrtest</finalName>-->
    
            <plugins>
              <!--  <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>App</mainClass> &lt;!&ndash; 此处为主入口&ndash;&gt;
                        </manifest>
                    </archive>
                </configuration>
                </plugin>-->
    
    
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <source>8</source>
                        <target>8</target>
                        <encoding>UTF-8</encoding>
                        <verbose>true</verbose>
                        <showWarnings>true</showWarnings>
                    </configuration>
                </plugin>
    
    
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <configuration>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <archive>
                            <manifest>
                                <mainClass>App</mainClass>
                            </manifest>
                        </archive>
                        <archiverConfig>
                            <encoding>utf-8</encoding>
                        </archiverConfig>
                    </configuration>
                    <executions>
                        <execution>
                            <id>make-assembly</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    <build>
    <!--<finalName>ocrtest</finalName>-->

    <plugins>
    <!-- <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>3.2.0</version>
    <configuration>
    <archive>
    <manifest>
    <addClasspath>true</addClasspath>
    <mainClass>App</mainClass> &lt;!&ndash; 此处为主入口&ndash;&gt;
    </manifest>
    </archive>
    </configuration>
    </plugin>-->


    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.1</version>
    <configuration>
    <source>8</source>
    <target>8</target>
    <encoding>UTF-8</encoding>
    <verbose>true</verbose>
    <showWarnings>true</showWarnings>
    </configuration>
    </plugin>


    <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
    <descriptorRefs>
    <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
    <archive>
    <manifest>
    <mainClass>App</mainClass>
    </manifest>
    </archive>
    <archiverConfig>
    <encoding>utf-8</encoding>
    </archiverConfig>
    </configuration>
    <executions>
    <execution>
    <id>make-assembly</id>
    <phase>package</phase>
    <goals>
    <goal>single</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    </plugins>
    </build>
  • 相关阅读:
    English Learning 2020
    TURKEY Example–KMAT stock order ZTIR/ KMAT dealer 3rd party order ZTR
    TURKEY Example–KMAT stock order ZOR
    ANZ Project
    Outlook Integration with Salesforce – A Step by Step Guide
    3rd party order swap and sales from stock
    Ford’s New 8-Speed Transmission Is GM’s 9-Speed, Minus A Gear
    The New Ford 8F35 8-speed Transmission
    Smartforms 打印文字压线问题
    abap table control里面各种属性和事件的写法
  • 原文地址:https://www.cnblogs.com/zhulibin2012/p/13948342.html
Copyright © 2011-2022 走看看