maven 打包 jar, cmd 打开jar 总结

maven 打包可执行jar

在pom中增加

 <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-assembly-pluginartifactId>
                <version>2.5.5version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>GddsParsemainClass>
                        manifest>
                    archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependenciesdescriptorRef>
                    descriptorRefs>
                configuration>
            plugin>

        plugins>
    build>

打包命令

#这么设置,可以制定Jdk编译版本
set JAVA_HOME=D:\soft\jrockit-jdk1.6.0_33-R28.2.4-4.1.0
set PATH=%JAVA_HOME%/bin;%PATH%
mvn package assembly:single 

bat打开jar

@echo off
java -jar login-1.0-SNAPSHOT-jar-with-dependencies.jar
@pause

你可能感兴趣的:(j2se)