maven-jar-plugin

disable the execution: default-jar

非 Y 不嫁゛ 提交于 2019-12-17 09:50:58
问题 i am using maven assembly plugin to pack a jar file. But when i run mvn package , maven always trigger the [jar:jar {execution: default-jar}] to create a default jar file. So i will have 2 jar files (one created by assembly plugin and one created by maven jar which i dont want to be created). How can i turn off the execution: default-jar. in my pom.xml, i am using : <packaging>jar</packaging> . i dont want to change it to <packaging>pom</packaging> . 回答1: (...) So i will have 2 jar files (one

How can I include test classes into Maven jar and execute them?

て烟熏妆下的殇ゞ 提交于 2019-12-17 07:18:18
问题 In a Maven project, I have test classes and source classes in the same package, but in different physical locations. .../src/main/java/package/** <-- application code .../src/test/java/package/** <-- test code It's no problem to access the source classes in the test classes, but I would like to run a test runner in the main method and access the AllTest.class so that I can create jar and execute my tests. public static void main(String[] args) { // AllTest not found Result result = JUnitCore

How do I build only one JAR file with classifier?

醉酒当歌 提交于 2019-12-14 03:59:11
问题 I'm using Maven 2 and maven-jar-plugin to build my jar . I'd like to generate only a jar with a classifier . Is it possible? In my example I'd like to generate only the myjar-another-1.0.jar but not myjar-1.0.jar . After take a look at this question I tried to skip the default-jar . But this seems to work only with version 3 of Maven (haven't tried thou. The parent is to do the <modules> Thanks all! Here is the relevant piece of my pom.xml: Also tried in the global configuration segment.

Maven jar dependencies and relations

妖精的绣舞 提交于 2019-12-13 02:49:31
问题 I tried to search for existing questions but cant find any - feels like my question is quite simple but probably because it's quite specific I cant find the answers anywhere. Anyways - I have 2 projects with Maven where the second depends on/needs some classes of the first. In certain cases I want the dependency to be on the JAR rather than a project dependency. I solved this by creating an additional jar with maven-jar-plugin, where i included the needed classes. The jar was correctly

How to avoid the generation of default jar when specifying a final name?

孤街浪徒 提交于 2019-12-12 04:26:16
问题 We are using maven profile to build a jar specific to tomcat. <profile> <id>TOMCAT</id> <build> <plugins> <plugin> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <id>default-jar</id> <phase>package</phase> <goals> <goal>jar</goal> </goals> <configuration> <finalName>${project.artifactId}-tomcat-${project.version}</finalName> </configuration> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.apache.activemq</groupId>

Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar

心不动则不痛 提交于 2019-12-11 12:56:57
问题 So I was trying to go ahead and create a .ear file for an existing maven project and further deploy it on WebLogic server . For the same, I went ahead to create the WAR , JAR and the EAR module and followed these steps for it - Right click on parent project , select new , select maven module , Named it as projectnameJARModule and then finished the wizard . Did the same process for creating a projectnameWARModule and a projectnameEARModule module. Once they were made, I added the WAR and the

Maven: Output JAR with arbitrary extension

半世苍凉 提交于 2019-12-11 04:33:19
问题 I have a Java project that, when mvn install is executed on it, generates a JAR file. So far so good. After that generation, I'd like to rename the resultant JAR file to something with an arbitrary extension. For example, say the resultant JAR that is generated is called "Foo.jar", I'd like to rename it to "Foo.baz" I'm trying to ascertain the magical plugin combo that will allow me to do this. So far, I've tried the following, based on this SO answer: <project> ... <build> <finalName>Foo<

Unable to disable generation of empty JAR (maven-jar-plugin)

你离开我真会死。 提交于 2019-12-11 02:56:32
问题 Sometimes, my Talend Open Studio components have resources but not Java sources (they are purely metadata components). I need to disable the generation of JAR files in such a case. I configured the maven-jar-plugin this way: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <configuration> <forceCreation>false</forceCreation> <skipIfEmpty>true</skipIfEmpty> <useDefaultManifestFile>false</useDefaultManifestFile> <

Maven: include files in JAR's META-INF

旧巷老猫 提交于 2019-12-07 07:19:24
问题 I'm using Maven to build a Java project, and I've got a couple files, CHANGELOG and LICENSE , that I'd like to copy to the META-INF directory inside the JAR file. So far what I've got working is the following: <build> <resources> <resource> <directory>${project.basedir}</directory> <includes> <include>CHANGELOG</include> <include>LICENSE</include> </includes> <targetPath>META-INF</targetPath> </resource> </resources> <plugins> ... but that also copies those two files to the classes/META-INF

How to include package.jar with maven-assembly-plugin

爷,独闯天下 提交于 2019-12-07 06:04:35
问题 I used maven and maven-jar-plugin and maven-assembly-plugin to build a zip of my project including the projects jar and its dependencies. This is the plugin configuration: <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>