How to build a multi-module maven project in jenkins - maven

I have a projects structure as follows:
ProjectParent
- pom.xml
ProjectApp
-pom.xml
ProjectAPI
-pom.xml
ProjectModels
-pom.xml
ProjectServices
-pom.xml
Etc..
ProjectModels/ProjectsServices are dependencies within ProjectAPI/ProjectApp.
Should I create separate jobs within Jenkins to build each module separately?
I created a job for ProjectAPP but get the following error below (Have set goals and actions to "clean install":
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myproject-app 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://maven.springframework.org/snapshot/com/myproject/myproject-common-config/0.0.1-SNAPSHOT/myproject-common-config-0.0.1-SNAPSHOT.pom
[WARNING] The POM for com.myproject:myproject-common-config:jar:0.0.1-SNAPSHOT is missing,
no dependency information available
Downloading: http://maven.springframework.org/snapshot/com/myproject/myproject-entities/0.0.1-SNAPSHOT/myproject-entities-0.0.1-SNAPSHOT.pom
[WARNING] The POM for com.myproject:myproject-entities:jar:0.0.1-SNAPSHOT is missing, no
dependency information available
Downloading: http://maven.springframework.org/snapshot/com/myproject/myproject-services/0.0.1-SNAPSHOT/myproject-services-0.0.1-SNAPSHOT.pom
[WARNING] The POM for com.myproject:myproject-services:jar:0.0.1-SNAPSHOT is missing, no
dependency information available
Downloading: http://maven.springframework.org/snapshot/com/myproject/myproject-persistence/0.0.1-SNAPSHOT/myproject-persistence-0.0.1-SNAPSHOT.pom
[WARNING] The POM for com.myproject:myproject-persistence:jar:0.0.1-SNAPSHOT is missing, no
dependency information available
Downloading: http://maven.springframework.org/snapshot/com/myproject/myproject-common-config/0.0.1-SNAPSHOT/myproject-common-config-0.0.1-SNAPSHOT.jar
......
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project myproject-app: Could not resolve dependencies
for project com.myproject:myproject-app:war:0.0.1-SNAPSHOT: The
following artifacts could not be resolved:
com.myproject:myproject-common-config:jar:0.0.1-SNAPSHOT,
com.myproject:myproject-entities:jar:0.0.1-SNAPSHOT,
com.myproject:myproject-services:jar:0.0.1-SNAPSHOT,
com.myproject:myproject-persistence:jar:0.0.1-SNAPSHOT: Could not find
artifact com.myproject:myproject-common-config:jar:0.0.1-SNAPSHOT in
org.springframework.maven.snapshot
(http://maven.springframework.org/snapshot)
ProjectParent Pom
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproject</groupId>
<artifactId>myproject-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>myproject-entities</module>
<module>myproject-services</module>
<module>myproject-persistence</module>
<module>myproject-app</module>
<module>myproject-merchant</module>
<module>myproject-common-config</module>
<module>myproject-api</module>
</modules>
<dependencyManagement>
<dependencies>
...
</dependencies>
</dependencyManagement>
<repositories>
...
</repositories>
<build>
...
</build>
<properties>
...
<myproject-entities-version>0.0.1-SNAPSHOT</myproject-entities-version>
<myproject-services-version>0.0.1-SNAPSHOT</myproject-services-version>
<myproject-persistence-version>0.0.1-SNAPSHOT</myproject-persistence-version>
</properties>
</project>
ProjectApp Pom
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.myproject</groupId>
<artifactId>myproject-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>myproject-app</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>myproject-app</name>
<url>http://maven.apache.org</url>
<dependencies>
...
<dependency>
<groupId>com.myproject</groupId>
<artifactId>myproject-common-config</artifactId>
<version>${myproject-common-config}</version>
</dependency>
<dependency>
<groupId>com.myproject</groupId>
<artifactId>myproject-entities</artifactId>
<version>${myproject-entities-version}</version>
</dependency>
<dependency>
<groupId>com.myproject</groupId>
<artifactId>myproject-services</artifactId>
<version>${myproject-services-version}</version>
</dependency>
<dependency>
<groupId>com.myproject</groupId>
<artifactId>myproject-persistence</artifactId>
<version>${myproject-persistence-version}</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<myproject-common-config>0.0.1-SNAPSHOT</myproject-common-config>
<myproject-entities-version>0.0.1-SNAPSHOT</myproject-entities-version>
<myproject-services-version>0.0.1-SNAPSHOT</myproject-services-version>
<myproject-persistence-version>0.0.1-SNAPSHOT</myproject-persistence-version>
</properties>
</project>
Am I using the wrong goals? Do I need to chain a number of commands? i.e. build other modules first?
I'm using Maven 3.
NOTE: I changed the target to "clean install" against the ParentProject Pom and everything builds correctly.
Thanks

The problem is that you can't create a project solely for the ProjectApp module because it depends on the other modules below the ProjectApp parent. If you don't deploy those modules to your maven repository, maven is not able to find them in the repository nor in the build reactor.
Instead you should create the job for the parent. This will build the necessary modules.
You may also work with the option also-make-dependants when you have a job for ProjectApp, but I haven't any experience with this.

Had the same problem, and SpaceTrucker answer helped me.
Hence I just run something like:
.../ProjectParent$ mvn -am -pl ProjectApp test

Related

How to supress maven-javadoc-plugin run form parent pom.xml?

I have a pom.xml https://repo1.maven.org/maven2/com/miglayout/miglayout-swing/5.2/miglayout-swing-5.2.pom
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.miglayout</groupId>
<artifactId>miglayout-parent</artifactId>
<version>5.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>miglayout-swing</artifactId>
<packaging>jar</packaging>
<name>MiGLayout Swing</name>
<description>MiGLayout - Java Layout Manager for Swing</description>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>miglayout-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
with this sources https://repo1.maven.org/maven2/com/miglayout/miglayout-swing/5.2/
And I got the following error:
INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 52.475 s
[INFO] Finished at: 2021-07-13T14:12:16+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.0:jar (attach-javadocs) on project miglayout-swing: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
[ERROR] javadoc: error - The code being documented uses modules but the packages defined in https://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.
Please tell me how to completely TURN OFF maven-javadoc-plugin? I need to build this project without javadoc.
Thank you
You can set the property maven.javadoc.skip to true, i.e. in your <properties> section add something like
<maven.javadoc.skip>true</maven.javadoc.skip>

Compile project that references installed project

I have a library module that I created through Maven, there is pom.xml what get dependencies:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.18.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example.library</groupId>
<artifactId>commons</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>commons</name>
<description>common dependencies library</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
With the above pom, I successfully installed it into the local maven repository by using mvn install.
In another project my-service, which uses this installed library, within the IntelliJ IDEA, it is fine compiling and running. There is the pom.xml for the my-service
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>my-service</name>
<description>My Services</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.18.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- other dependencies ... -->
<dependency>
<groupId>com.example.library</groupId>
<artifactId>commons</artifactId>
<version>1.0.0</version>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
However, when running with mvn compile, I got the following errors:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project my-service: Compilation failure: Compilation failure:
[ERROR] /Users/doe/IdeaProjects/my-service/src/main/java/com/example/myservice/configs/WebSecurityConfig.java:[3,45] package com.example.library.commons.filters does not exist
[ERROR] /Users/doe/IdeaProjects/my-service/src/main/java/com/example/myservice/configs/WebSecurityConfig.java:[17,13] cannot find symbol
[ERROR] symbol: class SessionFilter
[ERROR] location: class com.example.myservice.configs.WebSecurityConfig
[ERROR] /Users/doe/IdeaProjects/my-service/src/main/java/com/example/myservice/configs/WebSecurityConfig.java:[19,36] cannot find symbol
[ERROR] symbol: class SessionFilter
[ERROR] location: class com.example.myservice.configs.WebSecurityConfig
The library project is created as part of the IntelliJ IDEA module within the same project as the my-service module. I guess the IntelliJ IDEA knows how to internally references module to compile the depending modules, but with Maven, it is a different story.
My goal is to compile and package the my-service module as a single jar that includes the commons library module. Now I can't even get it to compile with Maven, what did I do wrong?
Apache Maven version 3.3.9 . Operating system: OS X.
It turns out the Spring-boot-maven plugin is not needed in the library project because a library doesn't need to produce an executable ueber jar. After removing the plugin, it compiles successfully.

How to build the simplest multi module Maven project using Windows command line?

I have multi module project which is very simple.
Directory structure:
C:\acme-project\parent
C:\acme-project\alpha
C:\acme-project\beta
Logical structure:
parent
/ \
alpha <- beta
I cannot build the beta because it depends on the alpha. And Meven doesn't want to build the alpha during the beta's build process!
C:\acme-project\beta> mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building beta 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.company:alpha:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.263 s
[INFO] Finished at: 2017-03-28T15:00:34+03:00
[INFO] Final Memory: 16M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project beta: Could not resolve dependencies for project com.company:beta:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: com.company:alpha:jar:1.0-SNAPSHOT: Could not find artifact com.company:alpha:jar:1.0-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
My POMs :
C:\acme-project\parent\parent.pom :
<?xml version='1.0' encoding='UTF-8'?>
<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.company</groupId>
<artifactId>parent</artifactId>
<version>1</version>
<packaging>pom</packaging>
<modules>
<module>../alpha</module>
<module>../beta</module>
</modules>
</project>
C:\acme-project\alpha\alpha.com :
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>com.company</groupId>
<version>1</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>alpha</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
C:\acme-project\beta\beta.pom :
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.company</groupId>
<artifactId>parent</artifactId>
<version>1</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>beta</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.company</groupId>
<artifactId>alpha</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
I can build the acme-project running mvn package in C:...\parent. But in case of more complex project parent could have 100 sub-modules. And obviously I don't want to build 98 modules (others that beta doesn't depend on) just to make Maven happy.
If you want to build just the projects that beta depends on, go to the root aggregator (i.e., the project with all the <modules>; parent in your case) and then ask Maven to build only beta and its dependencies in the current reactor:
cd parent
mvn package --projects com.company:beta --also-make
FYI, this can be abbreviated:
mvn package -pl :beta -am
In your minimal example, the above command will still build everything (as beta depends on alpha and implicitly on the parent), but in larger reactors it will build just the minimal subset necessary to build beta.

Maven hierarchical dependency search

So I have a problem, that is - Maven seems to ignore dependencies, even though they should be visible in hierarchy.
I have following project hierarchy:
parent
--projA
--sub-parent1
----projB
----projC
All levels are linked via <parent> tag.
sub-parent1 has projB and projC declared as modules and no dependencies declared. But projB has a dependency on projA. And building entire sub-parent1 module will not build projA, which is strange, because projB is aware of sub-parent1 and sub-parent1 is aware of parent and it is aware of dependency (projA). But maven do not build it whenever I build entire sub-parent1 or, for example, -pl projB -am clean install.
Any help appreciated.
Edit:
I've created a structure, representing this structure. Try to build sub-parent: dropmefiles.com/5l42j
Edit:
parent pom:
<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>test</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<modules>
<module>projA</module>
<module>sub-parent1</module>
</modules>
</project>
projA:
<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">
<parent>
<groupId>test</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>projA</artifactId>
<version>1.0</version>
</project>
sub-parent1:
<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>
<parent>
<groupId>test</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>sub-parent1</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<modules>
<module>projB</module>
</modules>
</project>
projB:
<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">
<parent>
<groupId>test</groupId>
<artifactId>sub-parent1</artifactId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>projB</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>test</groupId>
<artifactId>projA</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
Edit:
Although I had the same solution as in Maven multi module project cannot find sibling module - this problem is different as it deals with not only with multimodule, but with multilevel (several levels of modules) project and person there did not told maven explicitly to build dependencies aswell.
Solution:
So it seems the only solution is - build such multilevel structure from the upper-most level pom, in my case it will be parent (so parent is current dir) and address module you need to build by relative path from the parent. That results in:
mvn -pl sub-parent1/projB -am clean install
The order will be:
[INFO] Reactor Build Order:
[INFO]
[INFO] parent
[INFO] projA
[INFO] sub-parent1
[INFO] projB
So it seems the only solution is - build such multilevel structure from the upper-most level pom, in my case it will be parent (so parent is current dir) and address module you need to build by relative path from the parent. That results in:
mvn -pl sub-parent1/projB -am clean install
The order will be:
[INFO] Reactor Build Order:
[INFO]
[INFO] parent
[INFO] projA
[INFO] sub-parent1
[INFO] projB

TeamCity, Maven Build not found child module

I've Maven project with one subproject, when I run my install task on parent project from IDEA (IntelliJ IDEA) all works fine and maven resolve child module.
My projects are versioned on subversion, and this is the filesystem structure:
project
|--pom.xml
|--subproject
|
|-- branches
|-- tags
|-- trunk (here there is my subproject source, also pom.xml file)
I've create project with its subproject, from svn URL, on teamcity server.
When I run Build on parent project it fail and return me the following error:
[Step 1/1] Error reading Maven project: Some problems were encountered while processing the POMs:
[ERROR] Child module /opt/buildAgent/work/ee114e0c77ee2c44/subproject of /opt/buildAgent/work/ee114e0c77ee2c44/pom.xml does not exist #
How can I say to parent-project-build where it find the child module?
Is there something else wrong?
Parent POM:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.company.project</groupId>
<artifactId>MyProject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>MyProject</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<modules>
<module>Foo</module>
</modules>
</project>
Child POM:
<?xml version="1.0"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.company.project</groupId>
<artifactId>MyProject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>it.company.subproject</groupId>
<artifactId>subproject</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>subproject</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</resource>
</resources>
</build>
</project>
EDIT:
I added new parameter (pathSubproject) to my parent pom.xml, so when I run the parent build it skipped the previous error, but now it crash when trying to resolve parent dependency on the subproject. So I added a new parameter also at subproject (parentPath) and I passed it to relativePath inside parent tag.
Non-resolvable parent POM: Could not find artifact it.company.project:MyProject:pom:1.0-SNAPSHOT and 'parent.relativePath'
I think that my subproject POM not resolve the properties that I put inside <relativePath tag.
Is possible pass a properties to relativePath tag?
Thanks
In the <modules/> section of your parent project's pom, each module listed is a relative path to the directory containing the module.
So if you don't want to change the directory structure, you should be able to refer to the trunk of your subproject using <module>subproject/trunk</module>.
This does seem a bit clumsy though. If you are using the aggregator / modules pattern, I would recommend that project and subproject are both in the same SVN respository. If that isn't appropriate, then your subproject might not really be a module, and should be a dependency or have project as its parent artifact.
I solve my problem by creating 2 profile in my parent pom, the first one builds the parent application with all submodules, while the latter build only the the parent application.
In TeamCiTY build configuration settings I specified (inside Additional Maven command line parameters) the profile that build only parent module, and after I built the parent Application.
After that I built the parent application I built all submodules, and then I was able to build parent application with all modules.
I'm not sure that this is the right way, but in my case it worked well.

Resources