当我运行maven-jar-plugin时,jar:jar出现此警告,并且空的jar文件为空
[警告] JAR将为空-未标记任何内容!
构建成功,但是生成的jar文件为空,如警告所述。
我该如何解决?我试图在所有问题中找到解决方案,但所有解决方案都无法正常工作
这是我的pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.actticus.instdbparse</groupId>
<artifactId>instDBParse</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.github.igor-suhorukov</groupId>
<artifactId>instagramscraper</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.brunocvcunha.instagram4j</groupId>
<artifactId>instagram4j</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.14</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<index>true</index>
<manifest>
<mainClass>com.actticus.instdbparse.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
<classpathScope>test</classpathScope>
<mainClass>Main</mainClass>
</configuration>
<executions>
<execution>
<id>run-selenium</id>
<phase>integration-test</phase>
<goals><goal>java</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
答案 0 :(得分:2)
不要运行mvn jar:jar
,而要运行mvn clean package
。 jar:jar
目标只是打包-没有生命周期,没有东西可以打包。
查找“ Maven生命周期”以获取更多背景信息。