maven-2

Maven: Using inherited property in dependency classifier causes build failure

孤街浪徒 提交于 2019-12-05 16:20:20
Given three POM files: C depends on B. B inherits from A. I can build A and B C fails to build because of its dependency on B. The full source-code and build output is included below for your review. Here is A's POM: <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.foo</groupId> <artifactId>A</artifactId> <packaging>pom</packaging> <version>1.0-SNAPSHOT</version> <name>A</name> <repositories>

Maven in multimodule web project: how to put sibling modules output to WEB-INF/classes and not into WEB-INF/lib as JARs?

依然范特西╮ 提交于 2019-12-05 16:19:28
I have a multi-module Maven project. By default when I build a web module, all sibling modules of type JAR it depends on are copied to WEB-INF/lib folder. I want output of sibling modules to be placed in WEB-INF/classes folder without packaging to JAR. More general question may be: how to keep sibling modules' configuration files out of JARs so that they can be edited after deployment easily? You could use an overlay , although that requires that the sibling be of type war rather than jar. There's also using the dependency plugin to unpack the jar, but it will only unpack the version in your

How to ignore .java files when compiling using maven?

久未见 提交于 2019-12-05 16:19:09
I have .java files in my source directory that don't compile yet due to some API change. I would like to fix sources one by one and it would be useful to ignore some of them to run tests. Colin Hebert With the maven compiler plugin and the exclude option: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <excludes> <exclude>**/*Point*.java</exclude> </excludes> </configuration> </plugin> </plugins> </build> Resources: Maven 2 Compiler plugin - Compile mojo 来源: https://stackoverflow.com/questions/3621727/how-to

How do I use a template code generator (eg freemarker) in Maven?

人盡茶涼 提交于 2019-12-05 15:56:44
问题 How would you structure Freemarker (or an alternative) as a templating code generator into a Maven project? I'm pretty new to Maven and would appreciate some help. I want to generate some code from templates in my project. [a] Rather than write my own, googling found freemarker which appears to be used by Spring which is a good enough reference for me, though as I haven't started with it yet, any other suggestions that work well with Maven would be appreciated too. This website tells me how

Maven plugin for generating ISO file

北战南征 提交于 2019-12-05 15:49:08
Is there a maven plugin capable of generating ISO images? I need to take the output of some modules (mostly zip files containing jars) and combine them into a single ISO image. Thanks There is now an ISO9660 maven plugin that does the job: https://github.com/stephenc/java-iso-tools/commits/master/iso9660-maven-plugin Documentation is sparse but got it working with the following: <plugin> <groupId>com.github.stephenc.java-iso-tools</groupId> <artifactId>iso9660-maven-plugin</artifactId> <version>1.2.2</version> <executions> <execution> <id>generate-iso</id> <goals> <goal>iso</goal> </goals>

How to generate a JAR with the source code in Maven

删除回忆录丶 提交于 2019-12-05 15:44:24
问题 How can I use Maven 2.2 to generate a JAR with the source code inside it? 回答1: Use the <resources> element; nutshell: <build> <...> <resources> <resource> <directory>${basedir}/src/main/resources</directory> </resource> <resource> <directory>${basedir}/src/main/java</directory> </resource> </resources> <...> </build> Edit: Oh, I thought you meant you wanted a single jar with both normal jar contents and the source. 回答2: mvn source:jar This is using the source:jar plugin documentation Usage

How do you specify a string of goals as the defaultGoal in maven 2?

此生再无相见时 提交于 2019-12-05 15:12:26
I'm just curious, is there a way to specify that you want a string of goals run as the default goal in a maven project? Is there an equivalent to Ant's <project name="MyProject" basedir="." default="main"><target name="main" depends="clean,run"/> ? There is something roughly equivalent, you CAN define a default goal or phase that will be executed if none is given in the build element: <build> <defaultGoal>install</defaultGoal> ... </build> But this has to be a single phase, or goal, you can't pass multiple phases/goals (not really a problem since a phase triggers all preceding phases). Here is

how to ask maven war plugin to copy particular jar file into warfile/web-inf/lib

对着背影说爱祢 提交于 2019-12-05 14:47:52
I have a simple.jar file that stay in c:/JAR. When i used maven war plugin to create a war file, it will copy all the dependencies into lib folder. How can i ask maven to copy simple.jar into lib folder as well. I believe this will work for you. I'm not 100% sure the C:\\JAR is correct though. You might have to fiddle with this syntax. <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.0.2</version> <configuration> <webResources> <resource> <directory>C:\\JAR</directory> <targetPath>WEB-INF/lib</targetPath> </resource> <

Maven: clean the webapp directory before war:exploded?

我的梦境 提交于 2019-12-05 13:48:32
quoting from maven war plugin usage page : <project> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <webappDirectory>/sample/servlet/container/deploy/directory</webappDirectory> </configuration> </plugin> </plugins> </build> ... </project> How do i clean the content of the directory defined in the <webappDirectory>/sample/servlet/container/deploy/directory</webappDirectory> before exploding the war file ? In my experience, the folder defined as the webappDirectory wont get cleaned,

Why Maven is running tests again, when JAR is already there?

瘦欲@ 提交于 2019-12-05 13:33:44
I install my maven project: mvn clean install Everything works fine, JAR file is created in /target directory. Now I run it again: mvn install Maven executes unit tests and static code analysis again. I didn't make any changes to the .java files and JAR is there, so why running tests again? Am I doing something wrong or is it how maven is designed? Now I run it again (...) Maven executes unit tests and static code analysis again Because that's simply what you're asking Maven to do. When you call a build phase , Maven will execute not only that build phase, but also every build phase prior to