我无法在 pom.xml 中添加插件,我需要制作一个 maven 项目的可执行 jar
I can not add plugin in pom.xml, i need to make a executable jar of the maven project
我无法在 pom.xml file.Help 中添加插件来解决这个问题。
我需要这个插件来制作项目的 jar 文件。插件标签显示错误。我尝试了这些链接但无法修复它:http://wiki.netbeans.org/QuickStartJavaMavenProject
<?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.mycompany</groupId>
<artifactId>Restful_java_swing_M</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Restful_java_swing_M</name>
<repositories>
<repository>
<id>unknown-jars-temp-repo</id>
<name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
<url>file:${project.basedir}/lib</url>
</repository>
</repositories>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<springframework.version>4.3.0.RELEASE</springframework.version>
<mysql.connector.version>5.1.31</mysql.connector.version>
<jackson.library>2.7.5</jackson.library>
<hibernate.version>4.3.11.Final</hibernate.version>
</properties>
<dependencies>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>AbsoluteLayout</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
</dependencies>
<p>the plugin tag shows error. </p>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>mainJFrame</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</project>
哦,我解决了这个问题。插件标签没有显示错误,因为我在插件标签上放了一个构建标签。
的文档
There are the build and the reporting plugins:
Build plugins will be executed during the build and they should be
configured in the <build/>
element from the POM.
Reporting plugins
will be executed during the site generation and they should be
configured in the <reporting/>
element from the POM. Because the
result of a Reporting plugin is part of the generated site, Reporting
plugins should be both internationalized and localized. You can read
more about the localization of our plugins and how you can help.
因此对于您的情况,您需要确保插件在构建元素下定义为 -
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
... other details
</plugin>
... other plugins
</plugins>
</build>
我无法在 pom.xml file.Help 中添加插件来解决这个问题。 我需要这个插件来制作项目的 jar 文件。插件标签显示错误。我尝试了这些链接但无法修复它:http://wiki.netbeans.org/QuickStartJavaMavenProject
<?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.mycompany</groupId>
<artifactId>Restful_java_swing_M</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Restful_java_swing_M</name>
<repositories>
<repository>
<id>unknown-jars-temp-repo</id>
<name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
<url>file:${project.basedir}/lib</url>
</repository>
</repositories>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<springframework.version>4.3.0.RELEASE</springframework.version>
<mysql.connector.version>5.1.31</mysql.connector.version>
<jackson.library>2.7.5</jackson.library>
<hibernate.version>4.3.11.Final</hibernate.version>
</properties>
<dependencies>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>AbsoluteLayout</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
</dependencies>
<p>the plugin tag shows error. </p>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>mainJFrame</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</project>
哦,我解决了这个问题。插件标签没有显示错误,因为我在插件标签上放了一个构建标签。
There are the build and the reporting plugins:
Build plugins will be executed during the build and they should be configured in the
<build/>
element from the POM.Reporting plugins will be executed during the site generation and they should be configured in the
<reporting/>
element from the POM. Because the result of a Reporting plugin is part of the generated site, Reporting plugins should be both internationalized and localized. You can read more about the localization of our plugins and how you can help.
因此对于您的情况,您需要确保插件在构建元素下定义为 -
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
... other details
</plugin>
... other plugins
</plugins>
</build>