3 回答
TA贡献1813条经验 获得超2个赞
java -jar "app"
java -jar app.jar
Main-Class: com.mypackage.MyClass
com.mypackage.MyClass
jar cmvf META-INF/MANIFEST.MF <new-jar-filename>.jar <files to include>
<build> <plugins> <plugin> <!-- Build an executable JAR --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.1.0</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <classpathPrefix>lib/</classpathPrefix> <mainClass>com.mypackage.MyClass</mainClass> </manifest> </archive> </configuration> </plugin> </plugins></build>
<version>
<jar destfile="build/main/checksites.jar"> <fileset dir="build/main/classes"/> <zipfileset includes="**/*.class" src="lib/main/some.jar"/> <manifest> <attribute name="Main-Class" value="com.acme.checksites.Main"/> </manifest></jar>
plugins { id 'java'}jar { manifest { attributes( 'Main-Class': 'com.mypackage.MyClass' ) }}
TA贡献1943条经验 获得超7个赞
java -jar app.jar
java -jar "app"
.
-jar
Main-Class
java -cp app.jar com.somepackage.SomeClass
com.somepackage.SomeClass
main
TA贡献1799条经验 获得超6个赞
<plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>com.package.MainClass</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin>
添加回答
举报