maven-2

Best enterprise repository tool for Maven 2?

Some of the other questions and answers here on SO extol the virtues of using an enterprise repository tool like Archiva, Artifactory, or Nexus. What are the pros and cons of each? How do I choose between them? In case it helps: We use both Maven 1 and Maven 2 (at least for a while) We want to store both internally-generated artifacts...

How to use Maven Modules without svn:externals

I have never quite understood how/why I would use Maven modules (reactor builds). We have tens of libraries that we share (as dependencies) among our products, and between libraries as well. If we were to switch to making them maven modules, how would we set it up, both in svn and in our working copies? Do Maven Modules really need to...

Different dependencies for different build profiles in maven

Is it possible to have a different set of dependencies in a maven pom.xml file for different profiles? e.g. mvn -P debug mvn -P release I'd like to pick up a different dependency jar file in one profile that has the same class names and different implementations of the same interfaces. ...

Does a pom.xml.template tell me everything I need to know to use the project as a dependency

I'm trying to add the lucene sandbox contribution called term-highlighter to my pom.xml. I'm not really that familiar with Maven, but the code has a pom.xml.template which seems to imply if I add a dependency that looks like: <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-highlighter</artifactId> </dependency>...

Maven: Missing: org.apache.maven.wagon:wagon-ftp:jar:1.0-rc1-SNAPSHOT

I'm new to Maven so I may be missing something obvious, but I've got a maven project and when I try to "mvn package" this project it fails with ERROR BUILD ERROR INFO ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Missing: ---------- 1) org.apache.maven.wagon:wagon-ftp:jar:...

How do I use BGGA closures prototype on standard Mac JDK6?

I am trying to use the BGGA closures prototype with an existing JDK 6 (standard on Mac OS X Leopard). The sample code I'm compiling is from a BGGA tutorial: public static void main(String[] args) { // function with no arguments; return value is always 42 int answer = { => 42 }.invoke(); System.out.println(answer); } I have trie...

Including non-Java sources in a Maven project

I'm starting on a project that I expect will include a substantial amount of non-Java code (mostly shell and SQL scripts). I would still like to manage this project with Maven. What are the best practices wrt non-Java source code and Maven? Where should the source go? What happens to them during the different lifecycle phases? Any point...

Comparative advantages of xdoc and apt formats

What are the relative merits of the xdoc and apt formats for writing websites of Maven projects? Is one more expressive than the other? Has one got better tool support than the other? ...

Complex profiles in maven

I've been looking at profiles in maven for selecting different sets of dependencies. This is fine when you want to build say a debug build differently from a release build. My problem is that I want to do a fair bit more than this. For my application (Mobile Java app where J2ME is just one target among many) there may be a large number o...

Sharing Test code in Maven

How can you depend on test code from another module in Maven? Example, I have 2 modules: Base Main I would like a test case in Main to extend a base test class in Base. Is this possible? Update: Found an acceptable answer, which involves creating a test jar. ...

Starting external process during integration testing in maven

I want completely automated integration testing for a Maven project. The integration tests require that an external (platform-dependent) program is started before running. Ideally, the external program would be killed after the unit tests are finished, but is not necessary. Is there a Maven plugin to accomplish this? Other ideas? ...

Preprocessing source code as a part of a maven build

I have a lot of Java source code that requires custom pre-processing. I'd like rid of it but that's not feasible right now so I'm stuck with it. Given that I have an unfortunate problem that shouldn't have existed in the first place, how do I solve it using maven? (For the full story, I'm replacing a python-based build system with a ma...

How do I add an extra source directory that will be used by the maven-jxr-plugin?

I'm using the build-helper-maven-plugin to add it to my build, but I'd like to see the XREF source for this extra source directory as well. FYI: maven-jxr-plugin - The JXR plugin produces a cross-reference of the project's sources. The generated reports make it easier for the user to reference or find specific lines of code. It is also...

Using maven2 to build autotools-based C/C++ package

I am working on a collection MATLAB, Java, and C/C++ components that all inter-operate, but have distinctly different compilation/installation steps. We currently don't compile anything for MATLAB, use maven2 for our Java build and unit tests, and use autotools for our C/C++ build and unit tests. I would like to move everything to a si...

How do you version your projects and manage releases?

Our situation is as follows, but I'm curious about this problem in any situation. We have a framework consisting of 4 projects: beans util framework web We also have modules that need a version and depend on a version of beans and util. Finally we have a customer project that consists of a specific version of the core projects and ...

Is this the right approach for structuring codebase?

We have a Java codebase that is currently one Web-based Netbeans project. As our organization and codebase grows it seems obvious that we should partition the various independent pieces of our system into individual jars. So one Jar library for the data access layer, one for a general lib, one for a specialized knowledge access, etc. The...

How to specify JVM argument for Maven built executable JAR

When using Maven to build an executable JAR, how do I specify the JVM arguments that are used when the JAR is executed? I can specify the main class using <mainClass>. I suspect there's a similar attribute for JVM arguments. Specially I need to specify the maximum memory (example -Xmx500m). Here's my assembly plugin: <plugin> <a...

Cobertura refuses to acknowledge code was covered

I am using the Maven (2) Cobertura plug-in to create reports on code coverage, and I have the following stub I am using in a method: try { System.exit(0); } catch (final SecurityException exception) { exception.printStackTrace(); } System.err.println("The program never exited!"); I know that I need to log the exception, etc, b...

How to get Cobertura to fail M2 build for low code coverage

I'm trying to configure my WAR project build to fail if the line or branch coverage is below given thresholds. I've been using the configuration provided on page 455 of the excellent book Java Power Tools, but with no success. Here's the relevant snippet of my project's Maven 2 POM: <build> ... <plugins> <plugin> <groupId>org.code...

Use maven2 for build-automation and continuous integration of an eclipse rcp project?

My company starts a new project next week. We have planned to develop the application with eclipse rcp. The build process should be fully automated, so we're prepared to set up a continuous integration environment (e.g. Continuum). For the build-automation-part I intended to use maven2, because I want use its dependency management. I ha...