我有一个CXF WS项目,我会在另一个项目中使用它,我会在Web项目中使用这个WS,但我不知道如何生成Jar文件.
请你有任何想法或一个例子吗?
谢谢
我有一个项目,我需要重命名由Maven Assembly Plugin其他所有其他完成后生成的最终输出文件(在编译/构建/组装过程中).
该Maven Assembly Plugin是生成最终.zip文件的基础上,项目的名称,我需要完全重新命名这final-version.oxt.我正在尝试使用它maven-antrun-plugin来重命名它,正如其他类似问题所指出的那样,但没有运气(我之前从未使用过Maven或Ant,所以也许我错过了一些东西).
这是该<build>项目的一部分pom.xml.重命名部分似乎完全被忽略,因为我的home文件夹中没有生成文件.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>assembly</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
</archive>
<descriptors>
<descriptor>src/main/assembly/ooo-jar.xml</descriptor>
<descriptor>src/main/assembly/ooo.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>deploy</phase>
<configuration>
<tasks>
<copy file="${project.build.directory}/target/libreofficeplugin-ooo.zip"
tofile="/home/brunofinger/final-version.oxt" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud) 嗨:我发现默认情况下maven部署会更改文件名以匹配版本+工件ID.例如
使用artifact = A和version = V-0.1部署jar文件将生成名为AV-0.1.jar的jar文件.
有没有办法在部署中更改jar文件的默认名称,以便它不会连接这些字段或明确指定最终部署的jar名称?
我有一个配置文件,我想在maven pom.xml中包含它作为依赖项.我想保留它的几个版本,并让它出现在类路径中.我意识到我可以将它包装在一个罐子里,但我团队中的其他人想要轻松检查它的内容.看看pom.xml中允许的类型,我只看到像pom,jar,war,ear等的东西......基本上只是某种档案.所以我想知道打包单个文件的pom.xml是什么样的.我会在检查服务器时对maven工件进行成像
myconfig-0.0.1.cfg
myconfig-0.0.1.cfg.md5
myconfig-0.0.1.cfg.sha1
myconfig-0.0.1.pom
myconfig-0.0.1.pom.md5
myconfig-0.0.1.pom.sha1
Run Code Online (Sandbox Code Playgroud)
这可能吗?pom.xml会是什么样子?
我使用maven和maven-jar-plugin以及maven-assembly-plugin来构建我的项目的zip,包括项目jar及其依赖项.
这是插件配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<configuration>
<archive>
<manifest>
<mainClass>MyMainClass</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
这是assembly.xml:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<includes>${project.build.finalName}</includes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/lib/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
Run Code Online (Sandbox Code Playgroud)
我尝试使用maven-jar-plugin创建的jar <fileSet><includes>${project.build.finalName}</includes>....但这会引发错误:
Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.4:single (default) on project tbdb-core: Error reading assemblies: Error reading descriptor: src/main/assembly/assembly.xml: expected START_TAG …Run Code Online (Sandbox Code Playgroud) 我成功地设法使用标签将maven项目中的JAR部署到Github.但是,当前配置假定JAR的文件名始终保持不变,而不是.当我执行新版本时,这将相应地更改,因此部署将失败.
有没有办法在YAML文件中使用通配符?从我在Stackoverflow和Web上找到的内容来看,YAML不支持通配符.我没有在没有操纵.travis.yml文件的情况下找到另一个黑客,我想避免.
版本字符串可用于pom.xml.
目前.travis.yml:
language: java
jdk:
- openjdk7
deploy:
provider: releases
api_key:
secure: asfdsdflkjsdflkj...
file: target/helloci-1.0-SNAPSHOT.jar
on:
repo: ktk/helloci
all_branches: true
tags: true
Run Code Online (Sandbox Code Playgroud)
我肯定能以某种方式编写脚本但是Travis CI会更改自己的配置文件,我不确定这是否会起作用,b)是个好主意.
Repo我正在玩:https://github.com/ktk/helloci
我war通过在我的Spring项目的根目录中执行此命令生成了一个文件:mvn package
生成的war文件称为hib-1.0.0-BUILD-SNAPSHOT.war
我发现第一个词hib是项目的artifactId.
如何为生成的war文件指定自定义名称?
当我使用此命令时,我想创建一个没有SNAPSHOT原因的jar文件
mvn -f pom.XML package
Run Code Online (Sandbox Code Playgroud)
创建了两个文件“文件名_SNAPSHOT.jar和文件名_SNAPSHOT_WITH_dependencies.jar”。我想要文件名.jar,我知道我应该在pom.XML中进行编辑,因此我尝试添加此文件
mvn -f pom.XML package
Run Code Online (Sandbox Code Playgroud)
但是它创建了文件名name_SNAPSHOT_source.jar我该如何解决?
我的pom.XML这样的
<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">
<model Version>4.0.0</model Version>
<group Id>MyProject</group Id>
<artifact Id>MyProject</artifact Id>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
Run Code Online (Sandbox Code Playgroud) <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>org.jboss.tools</groupId>
<artifactId>example</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>example</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<finalName>example</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warName>example.war</warName>
<failOnMissingWebXml>true</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Run Code Online (Sandbox Code Playgroud)
我正在为我的项目使用上面的代码配置.但是当我通过eclipse构建我的项目时,它将项目部署为:example-0.0.1-SNAPSHOT.我不明白为什么-0.0.1-SNAPSHOT追加到我的项目名称之后?我更新了我的版本.但我仍然得到同样的错误.