maven-2

Maven: Different property files for different profiles

℡╲_俬逩灬. 提交于 2019-12-29 06:24:13
问题 I'm using different maven profiles to deploy my application to different environments. (With the weblogic-maven-plugin, but I think this is not important) In the application I use Spring Web Services. Now I'd like to change the endpoint depending on the environment. (The endpoint is defined in Spring's applicationContext.xml) My idea is to read the value from a property file. This property file will be written (or copied) during Mavens package phase. Is this a good idea? If yes: How do I

Using maven using non standard directory layout

天大地大妈咪最大 提交于 2019-12-29 04:22:05
问题 I am trying to apply maven to an existing project which already has a directory structure in place. All I can find from previous question is the following. Maven directory structure However, my requirement is more detailed. Please see below for the directory structure: <root dir> | +--src-java | +--src-properties | +--WEB-INF I know we could have something like <build> <sourceDirectory>src-java</sourceDirectory> ... </build> But sourceDirectory is for JAVA source code only, if I'm not

How do I get Maven to fail when conflicting versions of the same artifact are referenced?

▼魔方 西西 提交于 2019-12-29 03:53:08
问题 I'd like my Maven build to fail if the same artifact is referenced with different versions in my dependency tree. This would seem like a fairly trivial option, but I can't work out how to do it. Any clues? 回答1: The maven-enforcer-plugin has a dependencyConvergence rule which does what you want. Here's an example from the documentation. This will cause a build to fail: <dependencies> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-jdk14</artifactId> <version>1.6.1</version> <

Buildr, Gradle or wait for Maven 3? [closed]

*爱你&永不变心* 提交于 2019-12-29 02:32:30
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I am really tired of struggling with Maven 2 all the time. Build tools should not be in the way. Recently I have been looking at Buildr and Gradle. Maven 3 seems to fix some of the struggles. So, what should I go for now? Buildr? Gradle? Or wait a year for Maven 3? 回答1: No

Maven, how to add additional libs not available in repo

拜拜、爱过 提交于 2019-12-29 00:06:40
问题 I have a maven project that has a set of library dependancies that are not available via any maven repository. How can I add those libraries to the pom? I want to do this so when I run 'mvn eclipse:eclipse' it doesnt remove those libraries from the eclipse classpath. 回答1: You have 3 options: Add your libraries to your local repository via install:install-file (obviously, this is not portable, you won't be able to build the project on another machine without doing the same). Install and run an

Access maven project version in Spring config files

久未见 提交于 2019-12-28 13:56:11
问题 I would like to display the currently running version of my web application in the page. The project is based on Maven, Spring, and Wicket. I'd like to somehow get the value of maven's ${project.version} and use it in my spring XML files, similarly to the way I use the Spring PropertyPlaceholderConfigurer to read a property file for settings that I use in my application. If I had the maven project.version available as a variable in my Spring config, I could do something like this: <bean id=

Maven: compile aspectj project containing Java 1.6 source

隐身守侯 提交于 2019-12-28 05:21:34
问题 Primary Question What I want to do is fairly easy. Or so you would think. However, nothing is working properly. Requirement: Using maven, compile Java 1.6 project using AspectJ compiler. Note: Our code cannot compile with javac. That is, it fails compilation if aspects are not woven in (because we have aspects that soften exceptions). Update 2/21/2011: There are two equally viable solutions to this (both cases use the aspectj-maven-plugin in conjuction with the maven-compiler-plugin ): Add

Surefire is not picking up Junit 4 tests

大憨熊 提交于 2019-12-28 03:45:10
问题 For some reason I cannot get Maven 2 Surefire plugin to execute JUnit 4 test class. public class SimpleTest { @org.junit.Test public void simple() { System.out.println("foo"); } } However if I change this class to be JUnit-3 like, such as public class SimpleTest extends junit.framework.TestCase { public void testBar() { System.out.println("bar"); } @org.junit.Test public void simple() { System.out.println("foo"); } } then it gets executed. Here's what I've done: verified Maven version: Apache

maven-assembly-plugin doesn't add dependencies with system scope

痞子三分冷 提交于 2019-12-28 03:05:40
问题 This is my pom file: <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.sia.g7</groupId> <artifactId>sia</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>sia</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>log4j</groupId> <artifactId

maven-assembly-plugin doesn't add dependencies with system scope

独自空忆成欢 提交于 2019-12-28 03:05:07
问题 This is my pom file: <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.sia.g7</groupId> <artifactId>sia</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>sia</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>log4j</groupId> <artifactId