maven-assembly-plugin

Exclude file from jar as built by jar-with-dependencies

旧街凉风 提交于 2019-12-13 02:26:12
问题 My pom.xml contains the following to create a jar of my project with all dependencies. Now I have a properties file in src/main/resources which is necessary to run the application (and I want to use it from starting from the IDE), but I do not want to ship it in the created jar file, as the settings are maintained separately. Question : How I can I get a file with all dependencies, but exclude those properties files? <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions>

Maven assembly plugin: include file without taking its path folders

梦想的初衷 提交于 2019-12-12 18:24:35
问题 I'm using maven-assembly-plugin to include files from a dependency ZIP (also generated with assembly plugin) into a final release ZIP file. The issue is that I want to select which files from the dependency to get, but not copying the folder path where those files are. Just the files. For example: <assembly> <formats> <format>zip</format> <format>dir</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <dependencySets> <dependencySet> <includes> <include>package:artifactId

How to exclude a resource file in a Maven assembly?

自闭症网瘾萝莉.ら 提交于 2019-12-12 14:14:06
问题 I'm trying to exclude a resource file from my Maven build. I've copied the my-jar-with-dependencies.xml and added a section. This correctly excludes the named file from being copied to the jar's /src/main/resources but the file still gets copied to the jar's top level directory along with the other resources. <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org

maven-assembly-plugin and eclipse Workspace resolution

无人久伴 提交于 2019-12-12 05:49:06
问题 I have a project, which uses the maven-assembly-plugin to compile one JAR out of a number of projects. I want to run the build with eclipse (Neon 4.6.3). When I run the build, I select the option Resolve Workspace Artifacts . Resolving workspace artifacts seems to work fine for compiling the classes and testing. However, when it comes to executing the assembly into a JAR, maven does not use the projects from the eclipse workspace but only projects in the local maven repository . Is there a

Does the Maven Assembly Plugin (maven-assembly-plugin) support the EAR format?

烂漫一生 提交于 2019-12-12 02:57:10
问题 Does the maven-assembly-plugin support EAR as a valid format? The documentation seems to indicate you can configure it any way you want: zip tar.gz tar.bz2 jar dir war and any other format that the ArchiveManager has been configured for http://maven.apache.org/plugins/maven-assembly-plugin/ 回答1: Yes, it does. Just specify in your assembly descriptor: <formats> <format>ear</format> </formats> 回答2: It can but you should use the maven-ear-plugin instead, cause it know better about ejbs etc. of

How to prevent 'Error creating assembly archive distribution: A zip file cannot include itself'

主宰稳场 提交于 2019-12-11 20:29:18
问题 I have a multi module project and I want to make a zip with all sources (and other files). I use maven-assemble-plugin. I found a way with dependencySet, but I do not want add all my module sources (and later javadoc, too) as dependencies. I tried to use moduleSet, but I get an error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.6:single (make-zip) on project test-distribution: Failed to create assembly: Error creating assembly archive distribution: A zip

How to add test classes in JAR with Maven project

孤人 提交于 2019-12-11 15:58:47
问题 I am trying to include my test classes in a generated JAR in a Maven Project. I have created the Maven project and created the test classes with JUnit. When I am trying to build the JAR, these test classes are not included in the generated JAR. 回答1: You can produce a jar which will include your test classes and resources. Please refer maven official site - https://maven.apache.org/plugins/maven-jar-plugin/examples/create-test-jar.html <project> ... <build> <plugins> ... <plugin> <groupId>org

Running a jar file having multiple main classes using command line

孤街浪徒 提交于 2019-12-11 12:07:54
问题 Have added multiple main classes in jar using following code in pom.xml as follows <groupId>com.test</groupId> <artifactId>indexer</artifactId> <version>1.0.0-SNAPSHOT</version> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.4.1</version> <executions> <execution> <phase>package</phase> <id>build-first</id> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade

How to repackage to jar after assembly goal using maven?

情到浓时终转凉″ 提交于 2019-12-11 09:35:05
问题 I need to repackage to a jar file the content of multiple jars so I use Maven assembly plugin to unpack the jars to the assembly dir. This is done with a pretty standard assembly descriptor: <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> <id>assembly</id> <formats>

Maven - Copy Some Dependency JARs into warSourceDirectory

一个人想着一个人 提交于 2019-12-11 09:22:14
问题 Can any Maven plugins copy one or more dependencies (although not all of them) of a .war project into its warSourceDirectory ( src/main/webapp )? I'm working on a Java web-app that will display an applet. I'd like the war project to pick the latest version of some jars (the applet's dependencies) and stick them in /src/main/webapp/ , to save me having to copy them around the place. I've thought about shading and uber-jar-ing the applet itself, but I'd like to split the jars up to save users