Java 设置打包在WAR中的JAR名称
我创建了一个Java 设置打包在WAR中的JAR名称,java,maven,war,maven-war-plugin,Java,Maven,War,Maven War Plugin,我创建了一个WAR项目和一个JAR项目,设置为WARJAR项目的依赖项,我使用JAR项目pom文件中的标记来设置打包WAR时的文件名。 我运行maven安装,检查所有的名称是否正确。jar采用项目的名称,而不是标记中的名称。 为什么?如何设置jar的名称?我使用的是maven war插件版本3.0.0 预期结果:包含webservices.jar的AOL.war 实际结果:包含JarProject-3.0.0.jar的AOL.war <project xmlns="http://maven
WAR
项目和一个JAR
项目,设置为WAR
JAR项目的依赖项,我使用JAR
项目pom文件中的标记
来设置打包WAR
时的文件名。
我运行maven安装,检查所有的名称是否正确。jar采用项目的名称,而不是
标记中的名称。
为什么?如何设置jar的名称?我使用的是maven war插件版本3.0.0
预期结果:包含webservices.jar的AOL.war
实际结果:包含JarProject-3.0.0.jar的AOL.war
<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>WarProject</groupId>
<artifactId>WarProject</artifactId>
<version>3.0.0</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>b7</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>net.sf.flexjson</groupId>
<artifactId>flexjson</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7-dep</version>
</dependency>
<dependency>
<groupId>mate</groupId>
<artifactId>captcha</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>mate</groupId>
<artifactId>sifw</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>mate</groupId>
<artifactId>sifw-devel</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>mate</groupId>
<artifactId>sifw-upload</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>mate</groupId>
<artifactId>sifw-velocity</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>oracle</groupId>
<artifactId>jdbc</artifactId>
<version>6</version>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>WarProject</groupId>
<artifactId>WarProject</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
<build>
<!--sourceDirectory>src</sourceDirectory -->
<finalName>AOL</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<wtpversion>2.0</wtpversion>
<wtpContextName>WEBAOL</wtpContextName>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src</source>
<source>src_mega</source>
<source>src_ws</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<packagingExcludes>WEB-INF/classes/**/DocsServlet.class</packagingExcludes>
<packagingExcludes>META-INF/context.xml</packagingExcludes>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ProjectParent</groupId>
<artifactId>ProjectParent</artifactId>
<version>3.0.0</version>
</parent>
<artifactId>JarProject</artifactId>
<name>JarProject</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>webservices</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/java</directory>
<includes>
<include>**/*</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
<executions>
<execution>
<id>delete-files</id>
<phase>initialize</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<id>youbanking-ws</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlDirectory>wsdl/GestionePratica</wsdlDirectory>
<keep>true</keep>
<sourceDestDir>src/main/java</sourceDestDir>
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
jaxws-maven-plugin
</artifactId>
<versionRange>
[1.12,)
</versionRange>
<goals>
<goal>wsimport</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-clean-plugin
</artifactId>
<versionRange>[2.4.1,)</versionRange>
<goals>
<goal>clean</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
4.0.0
整经工程
整经工程
3.0.0
战争
ISO-8859-1
javax.servlet
javax.servlet-api
3.1.0
假如
org.slf4j
slf4j api
1.7.25
org.slf4j
slf4j-log4j12
1.7.25
Java文档对象模型
Java文档对象模型
b7
公地io
公地io
1.4
文件上传
文件上传
1.2.1
公地发现
公地发现
0.2
公用记录
公用记录
1.0.4
net.sf.flexjson
flexjson
2.1
org.apache.velocity
速度
1.7-dep
伙伴
验证码
1.
伙伴
sifw
1.
伙伴
sifw-devel
1.
伙伴
sifw上传
1.
伙伴
sifw速度
1.
神谕
jdbc
6.
轴
轴
1.3
整经工程
整经工程
3.0.0
美国在线
org.apache.maven.plugins
maven eclipse插件
2.9
2
WEBAOL
org.codehaus.mojo
构建助手maven插件
3.0.0
添加源
生成源
添加源
src
src_mega
src_-ws
maven编译器插件
3.7.0
1.7
1.7
maven战争插件
3.0.0
网络内容
WEB-INF/classes/**/DocsServlet.class
META-INF/context.xml
假的
真的
4.0.0
项目父级
项目父级
3.0.0
JarProject
JarProject
http://maven.apache.org
UTF-8
朱尼特
朱尼特
3.8.1
测试
网络服务
maven编译器插件
3.7.0
1.7
1.7
maven清洁插件
2.4.1
src/main/java
**/*
假的
删除文件
初始化
清洁的
org.codehaus.mojo
jaxws-maven插件
1.12
尤斯
wsimport
wsdl/GestionePratica
真的
src/main/java
-Djavax.xml.accessExternalSchema=all
org.eclipse.m2e
生命周期映射
1.0.0
org.codehaus.mojo
jaxws-maven插件