maven-2

APT and AOP in the same project, using Maven

浪尽此生 提交于 2019-12-21 20:28:47
问题 I have to use Annotation Processing (apt) and AspectJ in the same Maven project. Both work for themselves, but I need to create aspects based on code created by apt. So I would need binary weaving (the original source files are extended by apt). How can I enable binary weaving within a maven project? I know the only standard option is to supply a dependency using the weaveDependencies parameter, but this is awful. Is there any other way? OK, I could embed the AspectJ ant tasks using the Maven

Best approach for Java/Maven/JPA/Hibernate build with multiple database vendor support?

ε祈祈猫儿з 提交于 2019-12-21 20:14:30
问题 I have an enterprise application that uses a single database, but the application needs to support mysql , oracle , and sql*server as installation options. To try to remain portable we are using JPA annotations with Hibernate as the implementation. We also have a test-bed instance of each database running for development. The app is building nicely in Maven and I've played around with the hibernate3-maven-plugin and can auto-generate DDL for a given database dialect. What is the best way to

Eliminate Maven POM redundancy

狂风中的少年 提交于 2019-12-21 19:44:57
问题 I have a parent POM with the following config <groupId>com.example</groupId> <artifactId>parent</artifactId> <version>1.2-SNAPSHOT</version> Each child project which inherits from this parent POM, has a config such as the following: <parent> <groupId>com.amadeus.jcp.ui.skinning.skinning-system</groupId> <artifactId>parent</artifactId> <version>1.2-SNAPSHOT</version> </parent> I want all these project version numbers to stay in synch. At the moment, if I change the parent version to 1.3, I

Using different Spring properties for integration tests

怎甘沉沦 提交于 2019-12-21 17:55:52
问题 I am testing with Selenium a web application developed with Spring to check that the web application displays the right stuff for the user and that he's able to do everything that is in the specification. The other developers are using a fake Hibernate database in memory (HSQLDB) for unit testing. I have to use the real DB used by the program for testing, obviously. The JDBC parameters for the Spring application context are loaded by Spring at runtime (or compile time for building the WAR

set java system property during maven 2 compile?

北慕城南 提交于 2019-12-21 17:08:57
问题 I have a maven profile and want to set a property which is later on available per System.getProperty(..) in java: <profile> <id>local-dev</id> <properties> <my.comp.my.prop>myValue</my.comp.my.prop> </properties> </profile> I want System.getProperty("my.comp.my.prop") to be "myValue" but it's null .. How do I set it correctly? :) Thansk! 回答1: maven cannot set a property which can be accessed by your application from the environment at runtime. Instead, you can use maven to update a property

How to configure embedded OpenEJB container for tests properly?

梦想与她 提交于 2019-12-21 15:24:10
问题 This is my SLSB: @Stateless public class MyService { PersistenceContext(unitName = "abc") EntityManager em; public boolean exists(int id) { return this.em.find(Employee.class, id) != null; } } This is my persistence.xml (I'm using Glassfish v3): <persistence> <persistence-unit name="abc"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/MyDS</jta-data-source> <properties> <property name="hibernate.archive.autodetection" value="class" /> <property name=

Maven Release Plugin with Svn:Externals and a multi-module project

可紊 提交于 2019-12-21 12:44:44
问题 Given the following sample multi-module project: aggr/pom.xml (Version 1.0-SNAPSHOT) aggr/parent/pom.xml (Version 2.0-SNAPSHOT) aggr/app/pom.xml (Version 3.0-SNAPSHOT) aggr/comp1/pom.xml (Version 4.0-SNAPSHOT) where parent is the parent of any other pom and app has a dependency of comp1. Releasing via release:prepare/perform just works fine as long as the aggr folder has the same structure within the svn repository (repository/trunk/aggr/parent.pom, ...). Now when I want to use the same

How to get project version from Mavens's pom in Ant

安稳与你 提交于 2019-12-21 12:29:21
问题 I have maven project and ant task for it. In ant task i want to get version property from pom.xml. How to get it? In pom.xml: <version>2.03.010</version> 回答1: The Maven Ant tasks provide some goals for POM processing To access the version from a POM, you can use the following: <artifact:pom id="mypom" file="pom.xml" /> <echo>The version is ${mypom.version}</echo> Update: To use the tasks. You will need to install them. Install instructions You can either: Place the JAR in your Ant lib

Maven: Extract dependency resources before test

心不动则不痛 提交于 2019-12-21 12:22:11
问题 I have a multimodule Maven project. One subproject hosts XSL/XML resource files. The other project hosts Java code that needs to use these files in its unit tests. In the dependency's jar, the resources lie in the folder xml-resources . I found this example and tried to change it for my needs: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.4</version> <executions> <execution> <id>resource-dependencies</id> <phase>process-test

Maven project dependency against JDK version

丶灬走出姿态 提交于 2019-12-21 12:16:48
问题 I have projects that need to be build with a specific version of the JDK. The problem isn't in the source and target parameters but in the jars of the runtime used during compilation. In some cases I get a compilation error if I try to compile with the wrong JDK, but sometimes the build is successful and I get runtime errors when using the jars. For example in eclipse I have the ability to establish the execution enviroment for the project in the .classpath file. Is there a way to handle such