我想在Maven中构建两个不同版本的WAR(我知道这是一个禁忌,这就是现在的情况).在程序集描述的WAR版本中,我想用不同的分类器替换相同依赖项的依赖项.例如,我期待这个程序集工作:
<assembly>
<id>end-user</id>
<formats>
<format>war</format>
</formats>
<dependencySets>
<dependencySet>
<excludes>
<exclude>group:artifact:jar:${project.version}</exclude>
</excludes>
<includes>
<include>group:artifact:jar:${project.version}:end-user</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>
Run Code Online (Sandbox Code Playgroud)
这不起作用,但我是朝着正确的方向前进吗?我已经阅读了Maven组装页面上的所有页面以及看起来相关的Maven权威指南部分.任何指针都会有所帮助.
我有一个多模块项目,想要创建一个包含所有模块类的jar.在我的父POM中,我声明了以下插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>bin</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但是,在运行mvn assembly:assembly时,只包含父文件夹中的源(空).如何将模块中的源包含到存档中?
我试图找出Maven是否有一些可用于对工件进行时间戳的内置插件.我创建了一个程序集文件,并使用maven-assembly插件创建最终分发(jar,docs,scripts等).我想将此分发文件命名为domain_year_month_day.zip.如何将时间戳的日期部分附加到正在生成的最终zip文件的末尾.谢谢.
我有maven程序集插件的问题.
我有一个使用几个罐子的maven项目.每个jar包含配置文件.在另一个项目中,我使用maven程序集插件来组装独特jar中的所有配置.
一切正常,但不幸的是,两个文件名相同,第二个文件覆盖第一个.
我没有实现告诉maven合并两个文件而不是覆盖.
有人知道怎么做吗?
谢谢.
在我的Khatami项目中,我使用maven来管理编译并将结果打包成一个可运行的工件:顶层的可执行shell脚本,bin/包含可执行jar及其依赖的jar.请看看我的意思在这里.
作为参考,这是Khatami的重要部分pom.xml:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/src.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>${project.groupId}.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
<assembly>
<id>dist</id>
<formats>
<format>tar.gz</format>
</formats>
<dependencySets>
<dependencySet>
<outputDirectory>bin</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>src/main/assembly</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>khatami</include>
</includes>
<fileMode>744</fileMode>
<lineEnding>unix</lineEnding>
<filtered>true</filtered>
</fileSet>
</fileSets>
</assembly>
Run Code Online (Sandbox Code Playgroud)
和编译尝试:
$ mvn clean compile assembly:single
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building khatami 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ khatami ---
[INFO] …Run Code Online (Sandbox Code Playgroud) StackOverflow上有一些非常相似的问题,但是我找不到有用的东西.
现在,我正在尝试从构建的Jar中删除log4j.
虽然我是Maven的新手,但我确信我错了,这就是我正在尝试的.
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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.icf.onecpd</groupId>
<artifactId>pdfgen</artifactId>
<version>1.1</version>
<packaging>jar</packaging>
<name>PDF Generator</name>
<url></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>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
<scm>
<url>https://svn.tms.icfi.com/svn/HUD/onecpd/income_calculator_pdf_generator</url>
</scm>
</project>
Run Code Online (Sandbox Code Playgroud)
assembly.xml:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" …Run Code Online (Sandbox Code Playgroud) 当从IntelliJ ver 12进行远程调试时,我收到此消息"在线找不到可执行代码".这是一个Java应用程序.它正在使用maven来建立战争.不确定在何处进行更改以便正确进行调试.
我正在使用Maven程序集插件将我的Java项目的二进制文件打包成一个胖jar(带有jar-with-dependencies描述符).这非常有效.
问题:如何在编译的类文件旁边包含项目的源文件?我试着查看Maven文档以了解如何执行此操作但找不到任何内容.
谢谢!
我的pom.xml看起来像这样:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>${pom.artifactId}-${pom.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>${project.basedir}/bin/</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud) 我有一个项目有依赖A.项目正在打包到WAR和依赖A - 进入jar.另一个依赖关系B,也依赖于A.我想打包项目,当项目B打包时,它必须重建其依赖关系A而不是获得编译的依赖关系.请帮忙,我怎样才能做到这一点
我在Eclipse中有一个项目,在组装之后具有以下的包结构
launcher.tar.gz
|-- launcher.jar
|-- lib/
|-- resources/
|-- plugins/
Run Code Online (Sandbox Code Playgroud)
这是使用的maven-assembly-plugin.
为了使应用程序正常启动,有些resources是必需的,但在最终装配之外不可用,另外,我希望能够像我目前那样安装插件.
我目前的工作流程是
$ mvn [clean] package
$ cd target/launcher/
$ java -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -jar launcher.jar
Run Code Online (Sandbox Code Playgroud)
一旦应用程序以挂起状态启动,我可以附加调试器并恢复我的正常工作流程.
如何从Eclipse简化此过程?
我可以从我的Launcher.java类启动它,但是在Eclipse中调试时,我无法通过此方法安装插件.