Menu
  • HOME
  • TAGS

Maven multi-project depths

Tag: maven

I was trying to build Maven pom in something similar to the following hierarchical form:

root

   +-- A-POM

      +-- B-POM

      +-- C-POM

           +---D-POM

I was hoping that this could take care of my changed module problem. That is, if C is changed, then A must be rebuilt, etc.

But I ran into the issue that it seems the packaging at root is "pom," and after that I can't have A as packaging "war" then continue to drill in to have A include B, C as its modules. It seems to me that any POM which does not have "pom" in the then it can't have child modules. Is my understanding correct? Is there a way to do what I wanted to do?

In addition, I don't seem about to chain the "changed" mechanism in Maven (must due to my lack of knowledge). I like to have Maven detect a dependent project has changed and rebuild all the affected projects.

Thanks so much!

Best How To :

the reactor project (the root of the multimodule project) must have pom packaging. So your nested structure is invalid since A is not of type pom and I'm pretty sure you won't get it to work this way.

Second point is that Maven is a modularized build system and uses repository mechanisms to locate pre-built artifacts instead of checking out all modules from version control and building them in a monolithic way like in the old days ;) This means that Maven cannot know what to rebuild when you change something at your module since it simple does not have all the other module there at this time.

I think this is more a CI task than that should be handled by the build system itself. I know that your can achieve such a behavior with an appropriate build/CI Server like Jenkins that supports upstream and downstream projects. This means it is able to detect dependencies between the projects and trigger other builds as soon as a dependency has been built. This comes close to the behavior you are trying to achieve.

Btw. rebuilding other projects is only required for SNAPSHOT dependencies. Jenkins with the maven plugin supports this behavior but, depending on the number of SNAPSHOT dependencies of your project, this can cause long chains of project builds on the server. Some folks are of the opinion that in general SNAPSHOT versions are hell for CI tasks since these artifacts can change over time and are not reproducible. You could think over completely omitting SNAPSHOT versions and building final versions each time. This would also obviate your requirement to rebuild other modules as soon as a module changes. There are simply no changes until you upgrade dependency versions.

Maven can not find the 'main' class for my Java app

java,maven

Class names are case-sensitive. Your class is called Main so the manifest should be: <manifest> <mainClass>com.ollio.nlp.Main</mainClass> </manifest> ...

Grails 3.0 Searchable plugin

maven,grails

The page you took the instructions from contains the following disclaimer: This portal is for Grails 1.x and 2.x plugins. Grails 3 plugins are available in Bintray https://bintray.com/grails/plugins There currenly is no version of this plugin for grails 3.x...

Logging with log4j2 in Spring Boot app

java,spring,maven,logging,log4j2

You have multiple SLF4J bindings in your classpath. Logback classic, which is included by default in spring boot Log4j that you want to use. You need to have a single one in the classpath, by using maven dependency exclusion....

setting JAVA_HOME to the JDK location mac osx 10.9.5

java,osx,maven,java-home

My ~/.bash_profile has this line in it, and it's been working fine. export JAVA_HOME=$(/usr/libexec/java_home) This line basically says "run the program named /usr/libexec/java_home and export its output as a variable named JAVA_HOME." I suggest opening your .profile or .bash_profile in a text editor rather than using echo statements to append...

Unable to download com.thoughtworks.paranamer#paranamer;2.5.6 with sbt

maven,sbt

Author of Paranamer here. I've no idea why this happened. Could be related to https://issues.sonatype.org/browse/OSSRH-16113 Paul ...

Deploy closed source aar maven repo to github

android,git,maven,github,gradle

use the raw link, try changing blob for raw: http://downright-amazed.blogspot.com/2011/09/hosting-maven-repository-on-github-for.html...

How to make dependency transitive in Gradle

maven,javamail,android-gradle,build.gradle,gmail-api

The javax.mail-api-1.5.3 can also be downloaded from existing repositories (probably jCenter or mavenCentral) described in your build file. If you aren't tied to using your downloaded version in /libs, you might do this in your build file: dependency { compile 'javax.mail:javax.mail-api:1.5.3' } The default behavior in this case is to...

Maven Nested Modules - Second Level Children

maven,directory-structure,multi-module

Yeah, be there some time ago. To be honest, after trying things, I believe it's really matter of taste. For me it's much more clear to stick with root's pom.xml as a parent and not doing dedicated module for it. It's also the actual default of Maven, since <relativePath> for...

Liquibase 3.3.3 refusing to run “due to maven configuration”

maven,liquibase

Check here: CORE-2360 It looks like <skip> is set to true by default in 3.3.3 version. Just use 3.3.4 and it should be OK.

Unable to load servlet listener class: com.sun.faces.config.ConfigureListener

maven,jsf,tomee

Simply get rid of the in the exception mentioned <listener> entry in webapp's web.xml. TomEE ships with MyFaces, not Mojarra. That Mojarra-specific <listener> entry in web.xml is usually auto-included by some IDEs trying to be smarter than they are and/or left behind in poor quality open source projects. Be careful...

how to manage multiple war application in tomcat server?

java,maven,tomcat,servlets

Use same tomcat server, but copy and rename your web application to something different. For eg, original application name app, copy and rename as following. webapp -> app1 app2 app3 Running tomcat server per each war application need to maintain many server. This is a bad idea....

Maven multi-project depths

maven

the reactor project (the root of the multimodule project) must have pom packaging. So your nested structure is invalid since A is not of type pom and I'm pretty sure you won't get it to work this way. Second point is that Maven is a modularized build system and uses...

Flink error - org.apache.hadoop.ipc.RemoteException: Server IPC version 9 cannot communicate with client version 4

maven,hadoop,flink

Have you tried the Hadoop-2 build of Flink? Have a look at the downloads page. There is a build called flink-0.9.0-milestone-1-bin-hadoop2.tgz that should work with Hadoop 2.

Use alternative producers of EntityManager / EMF in integration tests

java,maven,jpa,integration-testing,cdi

After some research i found that DeltaSpike already has module called 'Test-Control', which enable use CDI in tests. So i decided to extend current EMF producer to read name of persistence unit from property file which contains configuration. Different property files in src/main/resources and src/test/resources lets me use different persistence...

sonar maven analysis only picks .java file

maven,groovy,sonarqube,sonarqube-5.0

Since it was a multi module project, I had to include the properties sonar.sources and sonar.tests in all the module's pom.xml file. <properties> <sonar.sources>src/main</sonar.sources> <sonar.tests>src/test</sonar.tests> </properties> ...

Missing artifact error while adding a depentency in pom

java,maven

You have used mismatched versions: sauce-connect-plugin presents in: http://repository-saucelabs.forge.cloudbees.com/release/com/saucelabs/sauce-connect-plugin/ which have only versions of 1.0.11, 1.0.12, 1.0.13 and 1.0.14. But you have tried to download 2.1.18 What you mentioned with the URL http://repository-saucelabs.forge.cloudbees.com/release/com/saucelabs/sauce-connect/3.1.32/ will not represent for sauce-connect-plugin. It will represent for only sauce-connect So you should try with following...

Eclipse error using Maven filtering in persistence.xml

maven,jar,persistence,filtering

I have solved it this way: in persistence.xml substitute the whole <jar-file> tag, i.e. <persistence-unit name="PersistenceUnit" transaction-type="JTA"> ... <!-- here is where the jar file is supposed to go --> ${importjarfile} ... </persistence-unit> Then include in pom.xml the property <properties> <!-- jar of persistence --> <importjarfile><![CDATA[<jar-file>lib/${project.persistencejar}.jar</jar-file>]]></importjarfile> </properties> or alternatively in...

Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.fs.CanSetDropBehind issue in ecllipse

maven,hadoop,apache-spark,word-count

When you run in eclipse, the referenced jars are the only source for your program to run. So the jar hadoop-core(thats where CanSetDropBehind is present), is not added properly in your eclipse from local repository for some reasons. You need to identify this if it is a proxy issue, or...

Eclipse Kepler is unable to set the Java jdk 1.8 when maven project is updated

java,maven,java-8,eclipse-kepler

With the help of Hogler's comment above I am able to reswolve this issue Just did this : https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler...

spring.xml not packaged in executable jar

java,spring,maven,executable-jar

If you're using maven, you can put your XML files in src/main/resources. By default, all files placed in the resources folder will be included in the jar file and will be accessible by your application.

Dyanamic web module 3.0 required java 1.6 or newer

java,maven,spring-mvc

When I got this error setting java version in pom fixed my problem In pom.xml you can set java version you can do this by setting below properties <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> or by providing version in maven-compiler-plugin....

Maven hamcrest parent depedency failed to resolve

maven,maven-3,dependency-management

Correct. There is no such artifact of jar type which is default if you don't specify any. This one will work: <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-parent</artifactId> <version>1.3</version> <type>pom</type> </dependency> ...

is it possible to filter artifacts in Maven-release-plugin?

maven,maven-release-plugin

I believe what you actually want to do is to release all modules (to handle proper versioning, dependencies, etc.) and only skip deploying some of them. If so, you can skip particular module for maven-deploy-plugin by its configuration: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> or user property: <properties> <maven.deploy.skip>true</maven.deploy.skip>...

How to deploy public-project Maven artifacts to a different remote repository?

maven

To deploy the created artifacts into another maven repository you need to add or change the <distributionManagement> section of the pom. Or add one and replace the one in the parent. The result will be that the deploy goal will upload the artifacts to the new location. Furthermore I would...

How to use a local tomcat version with maven

java,maven,tomcat

I found a solution here: https://tomcat.apache.org/maven-plugin-trunk/executable-war-jar.html Ex you set the serverXml to point to your local tomcat installation. <project> ... <packaging>war or pom</packaging> ... <build> ... <plugins> ... <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.3-SNAPSHOT</version> <executions> <execution> <id>tomcat-run</id> <goals>...

maven activate by property value and version

maven,maven-3

I believe there is no such functionality with out-of-the-box Maven. Maven is usually really simple when looking into its internals. Profile activation based on property is basically about two strings equality, nothing more, no extra logic here. I can image a solution that introduces own, simple Maven plugin that does...

How to configure user bundles so that they can be autostarted with higher priority - hence earlier than others?

java,maven,osgi,equinox

You were right. Start level in OSGi is defined by the @2 you put in your config.ini file. The default (by default) is a start level of 4. It seems that your problem is more related to a directory path problem to access the bundle rather than the load order...

Maven error with Java 8

java,maven,java-8

Add plugin configuration for the compiler: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <verbose>true</verbose> <fork>true</fork> <source>1.8</source> <target>1.8</target> </configuration> </plugin> ...

How to create zip file with maven: Java Client + JRE

java,maven,zip,client

Take a look at Apache Maven Assembly Plugin. For datailed instructions, see here and here....

Switching branches in Git with external dependencies

git,maven,dependencies,git-branch

It actually depends on an IDE you're using. I haven't noticed any issue with this when using IntelliJ IDEA. It handles any pom.xml changes on the filesystem level very smoothly. However, some time ago, when I was using Eclipse, I believe I saw such a problem you're talking about. Then...

Different ways to override java version especified in parent pom

java,maven,pom.xml

Properties are just properties, which do not mean much unless you use them somewhere. The important thing is that you set the version in the maven-compiler-pluginconfiguration: <properties> <jdk.version>1.6</jdk.version> </properties> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>${jdk.version}</source>...

How to filter attached sources using maven?

java,maven,maven-plugin,sources

You can already do this with the maven source plugin. See https://maven.apache.org/plugins/maven-source-plugin/jar-mojo.html where there are includes and excludes parameters.

Trying to access Oracle's Maven repository

oracle,maven,repository

From your settings.xml I can see that you use Artifactory. Why won't you define Oracle's repository as a remote in Artifactory? That will make the access much easier. Here's a simple guide on how to do so. And, of course, here's the official user guide on it. I am with...

maven-war-plugin include subdirectories

java,maven,maven-war-plugin

You can force maven-war-plugin to add empty folders if you say explicitly by using the appropriate configuration parameter: <project> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> <configuration> <includeEmptyDirectories>true</includeEmptyDirectories> .. </configuration> </plugin> </plugins> </build> ... </project> ...

How do you create a custom project type (from my plugin) without opening Eclipse?

java,eclipse,maven,eclipse-plugin

Here are my findings :- I went through the advice of Amos M. Carpenter and searched for the source code of the plugin that I have written. After that, I did a debug (Plugin Debug) and searched for the methods that are called when we create a project from the...

IntelliJ - use imported modules as dependencies like maven projects in Eclipse

eclipse,scala,maven,intellij-idea,sbt

It should work out of box for dependencies, which are imported to the project as modules, no additional settings needed. At least for Java. Just do not run a Maven goal, that would use dependencies from the repository. ...

Importing an OSGI bundle into eclipse

java,eclipse,maven,dependency-management,osgi-bundle

You will need to also install bundles that export these packages into your target platform.

deploying ejb-module for ObjectDB fails: PersistenceProvider not found

java,maven,ejb,wildfly,objectdb

Wow just writing about it here on SO helped me find my error :) I just have to force maven to include all dependencies. This can be done by including the following plugin into the pom.xml: <plugins> ... <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> <configuration> <descriptorRefs>...

Maven: copy zipped resource subdirectories into target folder

java,maven,zip

Please read the following article : http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html This has the complete information for creating a zip artifact. ...

Maven local artifactory file edit

java,maven,artifactory

First, do not upload maven-metadata files. They are generated by Artifactory for you. Second, since Artifactory usually manages uneditable binary files, there is no edit functionality in Artifactory. I am with JFrog, the company behind Bintray and [artifactory], see my profile for details and links....

When adding dependency: CDI deployment failure, Unsatisfied dependencies for type Set with qualifiers @Default

maven,twitter,glassfish,twitter4j,twitter-hbc

In Short: Use a newer version of Guava. Explanation I guess, you have Guava 14 or 15 on your class path. The class com.google.common.util.concurrent.ServiceManager contains an @Inject expecting a Set of services. This dependency is not available, and the container raises a DeploymentException. The solutions Use a newer Guava version...

How to access jenkins parent job build id in a MultiJob?

maven,jenkins

I'm using this method to pass the build ID from a parent multi-job into the children jobs: In the parent job, add a "Execute Shell" build step that saves the ${BUILD_ID} into a file, like this: cat > build.properties << _EOF_ PARENT_BUILD_ID=${BUILD_ID} _EOF_ For the "MultiJob Phase" -> "Phase Jobs",...

Cannot import correctly maven properties with PropertiesFactoryBean and PropertyPlaceholderConfigurer in spring

spring,maven,datasource,placeholder,jrebel

This can happen if you're using resource filtering with JRebel, as the application looks up the bean's xml in its unfiltered form from the project working directory (as per rebel.xml). To resolve this, you'll need to update rebel.xml for that module, adding exclude for that particular XML file - see...

exec-maven-plugin error, even on working example

java,eclipse,maven

The error log which you posted says the following: java.lang.ClassNotFoundException com.jadex.qna.QNAProject.App So it clear what the root source of the error is. You are trying to execute the main() method of a class whose class file Maven cannot find. As this SO article discusses, you can try explicitly compiling first,...

Gradle: Adding sources.jar file within /lib folder of published dist.zip along with all my other dependencies

java,maven,jar,gradle

You need to tell the application plugin to include the output of your sourcesJar task in the distribution: distributions { main { contents { from sourcesJar } } } That will place it in the root, if you want it somewhere else you can do this: distributions { main {...

@RestController throws HTTP Status 406

java,spring,rest,maven

The issue is with the dependencies that you have in pom.xml file. In Spring 4.1.* version the pom.xml dependency for Jackson libraries should include these: <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.4.1</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.4.1.1</version> </dependency> You...

Spring framework unable to start embedded container

java,spring,maven,spring-mvc,spring-boot

When using Spring Boot you should not include the other Spring dependencies directly, but rely on Boot's own dependency management. When using the provided "starters" you can be sure that all needed libraries will be included in a matching version. Instead of including spring-mvc artifact in your pom.xml: <dependency> <groupId>org.springframework</groupId>...

Failed to execute goal on project. Unable to find POM in project

java,maven,jboss

You need to add redhat repo in your pom.xml or setting.xml. Install and Use the Maven Repository such as: <repositories> <repository> <id>jboss-enterprise-techpreview-group</id> <name>JBoss Enterprise Technology Preview Maven Repository Group</name> <url>http://maven.repository.redhat.com/techpreview/all/</url> <layout>default</layout> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> <snapshots>...

Compilation Error on maven

java,eclipse,maven,maven-plugin

Check with that below dependency is it present or not ?? <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> <version>2.0-m01</version> </dependency> ...

spring-boot integration testing using rest-assured

maven,spring-boot,h2

Are you using Eclipse? I somehow noticed that src/main/resources/application.properties gets excluded from the Java Build Path, if you generate the project with the "eclipse:eclipse" maven goal. To workaround this you can either add a src/test/resources/application.properties or correct the Java Build Path. I don't know if this behavior is intended. I...