maven-2

Recommended solution for splitting up Maven projects?

依然范特西╮ 提交于 2019-12-03 11:47:14
问题 What is the best way to split up a large enterprise project in Maven? It's easy enough to understand how to partition things vertically like this... You have a DAO project The DAO project is a dependency of the Service project The Service project is a dependency of the web project. Does anybody have input on best practices in partitioning/splitting up really large projects in Maven.m 回答1: Some things that have helped me Use multi-module projects for projects that are related and only projects

Code generation in Maven

大城市里の小女人 提交于 2019-12-03 11:28:35
I want to autogenerate some java classes from interfaces. My first thought was to write a code generator, and integrate it as a maven plugin. I was thinking of creating a maven plugin with a codegen goal that is called during the build process. So if I choose this route, how do I provide the plugin with the interfaces to be processed? And where should the generated files go? Are there any existing plugins that can be configured to generate default class implementations? Sources should go in {project.build.directory}/generated-sources/[plugin-id]/ Most plugins take configuration passed through

Having a maven project build its own dependencies?

喜你入骨 提交于 2019-12-03 11:25:48
With maven is it possible to have a top-level project who's packaging type is "war" which will build itself and all of its dependent modules (packaged as jar) and have the build generate a project.war file? Much of the documentation examples and other examples I've seen often use a top-level project with packaging type of "pom" and the project only serves the purpose of tying the modules together. Can I avoid this? So basically I need something which is effectively like declaring a <module>my-module</module> for maven to build, and in that same POM, declaring a <dependency>...my-module's

Copying file from one project to another in maven

痞子三分冷 提交于 2019-12-03 11:23:34
问题 I'm working on a multi-module project. We're using the appCtx.xml from one module in few other modules. Current issue is that they're not always in sync with each other. It happens when someone modifies the file and the project builds, the person doing that can forget to copy to another module and it causes issues. How do I copy appCtx.xml inside src/main/resources from project A to src/main/resources in project B? 回答1: You can do this with the maven resources plugin: copy-resources,

What is the best way to launch HSQLDB for unit testing, when working with spring, maven and hibernate?

纵然是瞬间 提交于 2019-12-03 11:23:29
问题 In my project I can successfully test database code. I'm using Spring, Hibernate, HSQLDB, JUnit and Maven. The catch is that currently I have to launch HSQLDB manually prior to running the tests. What is the best way to automate the launching of HSQLDB with the technologies being used? 回答1: I am assuming that with hsql you are referring to HSQLDB. Configure your database url for JDBC drivers (for hibernate etc) to embedded memory based version of HSQLDB: jdbc:hsqldb:mem:myunittests Then a

Is packaging type 'pom' needed when not using project aggregation (multimodule)?

南笙酒味 提交于 2019-12-03 10:58:40
I want to inherit the dependencies of a (parent) pom.xml in a child project in Maven 2.2.1; i.e. use project inheritance. It seems it is necessary to change the default packaging type from jar to pom in this case. However, doesn't the Maven2 documentation state that the packaging type pom is necessary for project aggregation, i.e. multimodule projects which use submodules, but not for project inheritance? <project> <modelVersion>4.0.0</modelVersion> <groupId>example</groupId> <artifactId>example-parent</artifactId> <version>1</version> <dependencies> <dependency> <groupId>log4j</groupId>

If I run mvn deploy does it build new artifacts or it just deploy the already existing artifacts in to the remote server?

断了今生、忘了曾经 提交于 2019-12-03 10:54:49
问题 Note: This question has been originally posted by Lahiru Gunathilake as an answer to another question. I'm moving it here as a separated question for the sake of clarity. When we are doing a release we just build in our local machine and do the QA and then we host it in to repository. If we run mvn deploy does it create new artifacts, this cause having different artifact in the repository and in binary distribution because we are creating the binary distribution from our local repository. But

spring - @ContextConfiguration fail to load config file in src/test/resources

梦想的初衷 提交于 2019-12-03 10:47:35
问题 I've tried to load the spring config file in src/test/resources classpath with the following abstract class: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"classpath:/applicationContext.xml"}) public class BaseIntegrationTests { } I have the applicationContext.xml file in src/test/resources but spring cant load it. Thank you. 回答1: To be precise, it's the content of the test output directory ( target/test-classes ) that is on the class path, not src/test/resources .

JPA 2.0 API maven artifact

依然范特西╮ 提交于 2019-12-03 10:33:44
I am using JPA 2.0 and my persistence provider is Hibernate; however, I'd like to just include a standard API from javax, but in central, there is no 2.0 artifact. I am currently using the Hibernate JPA 2.0 artifact, but I'd like to use something more standard. Is this possible? Thanks, Walter Pascal Thivent I am currently using the Hibernate JPA 2.0 artifact, but I'd like to use something more standard There is still no javax.persistence:persistence-api:jar:2.0 artifact from Sun/Oracle. Either use the full javax:javaee-api:jar:6.0 artifact if you want something from Sun/Oracle... or just

Multiple Dependency Scopes in POM

懵懂的女人 提交于 2019-12-03 10:32:08
问题 I have a dependency in my POM that needs to be set to "provided" so it is not included at compilation, but it can still be referenced within my project. I would like the same dependency to have a scope of "test" when I go to run tests so I do not have to manually add the jar to my classpath. Is there a way to do this or achieve similar results? Reasoning behind this is that I have some common jars that are provided in my JBOSS lib directory, so I want to use these and keep the "provided"