Maven friendly CI - revision property doesn't work with Jenkins build - java

I'm trying to use maven friendly ci for my multi-module project. My project has three levels of parent child hierarchy, i.e., my parent project has few child projects and those child projects has many other child projects within them.
I have added a sample of my pom files below. My parent pom has a flatten plugin as well, everything works fine in my local machine. But when I build it from Jenkins, it doesn't work. And I get the below error
Error
[ERROR] [ERROR] Some problems were encountered while processing the
POMs: [FATAL] Non-resolvable parent POM for
com.faskan:child-module:[unknown-version]:
Could not transfer artifact
com.faskan:parent-module:pom:${revision} from/to nexus
Parent project's pom.xml
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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.faskan</groupId>
<artifactId>global-parent-dependency</artifactId>
<version>1.1.0</version>
</parent>
<groupId>org.faskan</groupId>
<artifactId>parent-module</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<name>project parent pom</name>
<properties>
<revision>21.15.0-SNAPSHOT</revision>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.2.2</version>
<configuration>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
...
</project>
Child project's pom.xml
<?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>
<artifactId>child-module</artifactId>
<parent>
<groupId>org.faskan</groupId>
<artifactId>parent-module</artifactId>
<version>${revision}</version>
</parent>
<name>child admin</name>
<packaging>jar</packaging>
..
</project>
Child of child project (grand child)
<?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>
<artifactId>grand-child-module</artifactId>
<packaging>jar</packaging>
<name>child of child module</name>
<parent>
<groupId>org.faskan</groupId>
<artifactId>child-module</artifactId>
<version>${revision}</version>
</parent>
..
</project>
I found a similar question How do you get maven child projects to build in Jenkins when using CI Friendly versions?. Not sure if mine is the same because I don't get any parse failure errors.

The following configuration is missing in your parent pom.xml for the flatten plugin:
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
I believe you have to add this configuration for ci-friendly projects, as explained here.

In
<parent>
<groupId>org.faskan</groupId>
<artifactId>parent-module</artifactId>
<version>${revision}</version>
</parent>
you can't have ${revision} for version. Maven don't know where to get it. You need to use actual version.
PS: I don't know how you manage to build it locally.

Related

Dockerfile Maven Plugin: Failure to find plugin

I want to use the plugin "Dockerfile Maven" to build docker images from my project. When I add this plugin into my pom.xml
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${dockerfile-maven-version}</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>spotify/foobar</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
I am getting an error on the first line of my pom:
Failure to find com.spotify:dockerfile-maven-plugin:jar:${dockerfile-maven-version} in https://
repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the
update interval of central has elapsed or updates are forced
Do I need to configure something? I can't find anyone with the same problem. This is my pom.xml configuration:
<?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>2.1.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>de.leuphana</groupId>
<artifactId>ArticleMicroService</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>ArticleMicroService</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
</properties>
Where did you define the value for variabledockerfile-maven-version?
You should add it to the properties
<properties>
<java.version>11</java.version>
<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
<dockerfile-maven-version>1.4.10</dockerfile-maven-version>
</properties>
Looks like you need to define dockerfile-maven-version in the section of your POM
Add to properties:
<dockerfile-maven-version>1.4.10</dockerfile-maven-version>

Invalid packaging for parent POM must be "pom" but is "war"

Could anybody suggest me an solution with the following exception. I am going to create a multi-module project. (War, Ear)
pom.xml (war)
<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>lu.pgd</groupId>
<artifactId>WebBusiness</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>WebBusiness-war</artifactId>
<packaging>war</packaging>
<name>Web Business</name>
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
<slf4j.version>1.7.5</slf4j.version>
</properties>
<build>
<finalName>webBusiness</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<configuration>
</configuration>
</plugin>
</plugins>
</build>
</project>
pom.xml (ear)
<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>lu.pgd</groupId>
<artifactId>WebBusiness</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>spdv-ear</artifactId>
<packaging>ear</packaging>
<name>Project EAR</name>
<dependencies>
<dependency>
<groupId>lu.pgd</groupId>
<artifactId>WebBusiness-war</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<finalName>WebBusiness</finalName>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<applicationId>WebBusiness</applicationId>
<displayName>SPDV (${project.version})</displayName>
<modules>
<webModule>
<groupId>lu.pgd</groupId>
<artifactId>WebBusiness-war</artifactId>
<contextRoot>/WebBusiness</contextRoot>
<moduleId>war</moduleId>
</webModule>
</modules>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
</plugins>
</build>
</project>
pom.xml (parent)
<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>lu.pgd</groupId>
<artifactId>WebBusiness</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Parent Project</name>
<modules>
<module>../SPDV_EAR</module>
<module>../WebBusiness</module>
</modules>
<packaging>pom</packaging>
</project>
When I tried to Run Maven Project Parent (Clean+Install) I got error like :
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Invalid packaging for parent POM lu.pgd:WebBusiness:0.0.1-SNAPSHOT, must be "pom" but is "war" # lu.pgd:WebBusiness:0.0.1-SNAPSHOT, C:\dev\lu\pgd\WebBusiness\0.0.1-SNAPSHOT\WebBusiness-0.0.1-SNAPSHOT.pom, line 7, column 13
[ERROR] Invalid packaging for parent POM lu.pgd:WebBusiness:0.0.1-SNAPSHOT, must be "pom" but is "war" # lu.pgd:WebBusiness:0.0.1-SNAPSHOT, C:\dev\lu\pgd\WebBusiness\0.0.1-SNAPSHOT\WebBusiness-0.0.1-SNAPSHOT.pom, line 7, column 13
#
[ERROR] The build could not read 2 projects -> [Help 1]
[ERROR]
[ERROR] The project lu.pgd:ccpd-ear:0.0.1-SNAPSHOT (C:\Users\x279\workspace\SPDV_EAR\pom.xml) has 1 error
[ERROR] Invalid packaging for parent POM lu.pgd:WebBusiness:0.0.1-SNAPSHOT, must be "pom" but is "war" # lu.pgd:WebBusiness:0.0.1-SNAPSHOT, C:\dev\lu\pgd\WebBusiness\0.0.1-SNAPSHOT\WebBusiness-0.0.1-SNAPSHOT.pom, line 7, column 13
[ERROR] The project lu.pgd:WebBusiness-war:0.0.1-SNAPSHOT (C:\Users\x279\workspace\WebBusiness\pom.xml) has 1 error
[ERROR] Invalid packaging for parent POM lu.pgd:WebBusiness:0.0.1-SNAPSHOT, must be "pom" but is "war" # lu.pgd:WebBusiness:0.0.1-SNAPSHOT, C:\dev\lu\pgd\WebBusiness\0.0.1-SNAPSHOT\WebBusiness-0.0.1-SNAPSHOT.pom, line 7, column 13
Could anybody help me here to understand what is going wrong here please ?
Copy your modules SPDV_EAR and WebBusiness into the parent project folder (ccpd). Then change the modules tag in the parent pom to:
<modules>
<module>SPDV_EAR</module>
<module>WebBusiness</module>
</modules>
Also in your parent pom change
<artifactId>WebBusiness</artifactId>
to
<artifactId>ccpd</artifactId>
In your war (WebBusiness):
<parent>
<groupId>lu.pgd</groupId>
<artifactId>ccpd</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>WebBusiness</artifactId>
In you ear:
<parent>
<groupId>lu.pgd</groupId>
<artifactId>ccpd</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>SPDV_EAR</artifactId>
So your folder names match your project names.
Usually the folder structure for a multi-module project is like this:
- parent-project-folder
- pom.xml (parent-project)
- submodule-project-folder
- pom.xml (submodule-project)
- another-submodule-project-folder
- pom.xml (another-submodule-project)
Then the parent definition you have would be fine, but you have the parent project next to your submodules, so you need to configure a bit more.
Try adding relativePath to your parent specifications:
<parent>
<groupId>...
...
<relativePath>path/to/your/parent/pom.xml</relativePath>
</parent>

Artifactory/JFrog is producing the wrong parent artifactId in generated POM

I have encountered a strange bug while trying to deploy new release builds to my company's JFrog.io (fka: ArtifactoryOnline.com) repository. The project I'm working on has multiple maven modules, all under a single parent. When I upload the JAR files that maven builds to JFrog, the generated POM file is being populated with the incorrect parent artifactId.
I spent a great deal of time and could not find any problems with my company's codebase for the project, so I decided if I could reproduce the error from scratch. Thus I made this throwaway project to demonstrate the bug. For those uninterested in downloading the full project, here are the relevant POM files:
The parent POM, "blueberry":
<?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>org.nbyrd</groupId>
<artifactId>blueberry</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<modules>
<module>blueberryjam</module>
<module>berries</module>
</modules>
</project>
Dependant POM 1: "berries":
<?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>blueberry</artifactId>
<groupId>org.nbyrd</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>berries</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Dependant POM 2, "berry-jam":
<?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>blueberry</artifactId>
<groupId>org.nbyrd</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blueberry-jam</artifactId>
<dependencies>
<dependency>
<groupId>org.nbyrd</groupId>
<artifactId>berries</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
(For what it's worth, all of these POM files were generated in their entirety by JetBrains IntelliJ.)
Pretty straight forward at this point: I have two Maven modules--"berries" and "berry-jam"--that are housed under a central parent module, "blueberry". berry-jam uses berries as a dependency, although I'm not sure if that's relevant to the problem.
When I build the project, I get two JAR files: berries-1.0.jar and berry-jam-1.0.jar. This is as expected. At this point, I would upload these artifacts to Artifactory so that other projects may reference them. And this is where the trouble starts.
When I upload berries-1.0.jar, Artifactory generates the following POM file:
<?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>berries</artifactId>
<groupId>org.nbyrd</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>berries</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
As you can see, the generated POM defines the parent artifactId as "berries", which is wrong.
The same problem occurs when I upload berry-jam-1.0.jar:
<?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>blueberry-jam</artifactId>
<groupId>org.nbyrd</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blueberry-jam</artifactId>
<dependencies>
<dependency>
<groupId>org.nbyrd</groupId>
<artifactId>berries</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
In both cases, I would expect the parentId to be "blueberry", as it is explicitly stated in both of the child-modules' POM files. These incorrect artifactIds make it impossible to use these libraries. If a third-party application attempts to use these libraries, maven will produce the following warning when downloading dependencies and the build will fail:
[WARNING] The POM for org.nbyrd:berries:jar:1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
This functionality used to work correctly in the past when uploading to Artifactory, so I'm not sure if something has changed in how the tool works or if I have simply done something wrong. Any thoughts?
When you use mvn deploy maven deploys the pom.xmlfile as separated artifact. But when you uploads the jar file with artifactory's web ui and asks artifactory to generate the pom file, I guess it generates it from the data presents in the jar. So the artifactory isn't aware about existing of a parent project.
I had similar problem and my guess was that artifactory is trying to fix pom by changing first artifactId value it can find. Not seeing that it's inside parent node.
So I moved parent node below artifactId/version and that worked for me.
<?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>
<artifactId>berries</artifactId>
<version>2.0</version>
<parent>
<artifactId>berries</artifactId>
<groupId>org.nbyrd</groupId>
<version>1.0</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

Maven is it possible to use sources jar as depdency in a maven project [duplicate]

This question already has answers here:
Maven - add dependency on artifact source
(2 answers)
Closed 8 years ago.
I would like to add a source jar to a gwt project using maven.
I tried to do it this way (it's just a poc for managing source dependencies)
source jar 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">
<parent>
<artifactId>test-source-dependencies</artifactId>
<groupId>com.niflheimcorp</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-source-jar</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
using jar 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.niflheimcorp</groupId>
<artifactId>test-utilisateur-jar</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.niflheimcorp</groupId>
<artifactId>test-source-jar</artifactId>
<classifier>source</classifier>
</dependency>
</dependencies>
</project>
when launching mvn clean install i got the following error :
[ERROR] Failed to execute goal on project test-utilisateur-jar: Could not resolv
e dependencies for project com.niflheimcorp:test-utilisateur-jar:jar:1.0-SNAPSHO
T: Could not find artifact com.niflheimcorp:test-source-jar:jar:source:1.0-SNAPS
HOT -> [Help 1]
But the artifact is installed by maven just at the precedent step
[INFO] Installing C:\Users\CRSD2193\psf\G4R0C3_portaFixe\test-sources-dependenci
es\test-source-jar\target\test-source-jar-1.0-sources.jar to C:\Users\CRSD2193.
m2\repository\com\niflheimcorp\test-source-jar\1.0\test-source-jar-1.0-sources.j
ar
I can't see a reason for the error unless we can't declare a source jar as a build deps.
Regards
Nemesis
Dumb typo on the classifier sources (forgot the s at the end :-/ ).

How make relative link work in maven site generation?

I have one parent project with submodule, I have already read explanation about links, I try to run
mvn clean site
And open Child link from index.html. I also try to run site:run goal from maven-site-plugin and visit:
http://localhost:8080/
So relative link "about" apge from maven site do not work. What is wrong? May be I misunderstood with site working?
See parent and child pom.xml below
Parent pom.xml
<?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>MavenSiteGeneration</groupId>
<artifactId>MavenSiteGeneration</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>Child</module>
</modules>
<description>Main project</description>
<!--<url>main-url</url>-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<!--<configuration>
<port>9000</port>
<tempWebappDirectory>${basedir}/target/site/tempdir</tempWebappDirectory>
</configuration>-->
</plugin>
</plugins>
</build>
<distributionManagement>
<site>
<id>someid</id>
<url>http://bash.org</url>
</site>
</distributionManagement>
<reporting>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
Child pom.xml
<?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>MavenSiteGeneration</artifactId>
<groupId>MavenSiteGeneration</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<description>Child project</description>
<artifactId>Child</artifactId>
<!--<url>/child</url>-->
<!--<distributionManagement>
<site>
<id>asd</id>
<name>name</name>
<url>/child1112</url>
</site>
</distributionManagement>-->
</project>
Could anybody tell me what is wrong?
P.S. You can see some tag in comments, I have already tried to comment/uncmment. Relative link do not work.
You need to run mvn site:stage first to get a directory that includes the sites of the module and its submodule (by default in target/staging/). This is also explained in the FAQ of the maven-site-plugin.
To run this goal, you need to provide the information in <distributionManagement><site>, as you have in the files posted above.
Running mvn site:run will however still not work, that goal can only be used for single modules.

Categories