Maven Multi Module Build

delphiking1980

Bekanntes Mitglied
Hallo,

ich habe ein Projekt mit N unterprojekten, welche alle in einer Parent POM.XML als Module gelistet sind.
Nun zu meinem Problem :

wenn ich mvn clean package ausführe dann werden die Module zwar gebaut aber leider auch mein Projekt mit der Dokumentation, d.h. ich habe dann ein JAR Datei mit meiner Doku, mmh aber auf diesen Ordner soll er ein mvn site ausführen. und kein mvn package.

Wo muss ich das ganze denn konfigurieren ?

Danke für jede hilfe.
 
Hi,
lass mal die pom's sehen...ohne wird das schwierig...

Ist das ein Multi-Module oder ein aggregations build ? Sprich habe die Kinder einen parent Eintrag der auf die Parent pom verweist ?

Was machst Du in dem Dokumentations Module ?

Gruß
Karl-Heinz Marbaise
 
Dann wuerd ich das Documentationsprojekt nicht als [XML] <packaging>jar</packaging>
[/XML]definieren, sondern als zip oder pom.
 
Hier ist meine POM.XML vom Parent Projekt :

[XML]
<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>de.xxx</groupId>
<artifactId>XXX</artifactId>
<version>0.0.47-SNAPSHOT</version>
<packaging>pom</packaging>
<name>XXX</name>
<description>MasterProject to union all build tasks</description>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<pushChanges>false</pushChanges>
<tagNameFormat>REL-@{project.version}</tagNameFormat>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<configLocation>${basedir}/../../build-dependencies/checkstyle.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<excludeFilterFile>${basedir}/../../build-dependencies/findBugs-excludes.xml</excludeFilterFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.7.1</version>
<configuration>
<rulesets>
<!-- Custom local file system rule set -->
<ruleset>${basedir}/../../build-dependencies/pmd-rulesets.xml</ruleset>
</rulesets>
<targetJdk>1.5</targetJdk>
<minimumTokens>200</minimumTokens>
</configuration>
</plugin>
</plugins>

</build>

<dependencies>
<dependency>
<groupId>websphere</groupId>
<artifactId>com.ibm.ws.webcontainer</artifactId>
<version>2.0.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>websphere</groupId>
<artifactId>j2ee</artifactId>
<version>7.0.0.11</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<!--
<dependency> <groupId>com.ibm.websphere.appserver</groupId>
<artifactId>runtime</artifactId> <version>6.1.0.35</version>
<type>pom</type> <scope>provided</scope> </dependency>
-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>

<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>

<properties>
<project.build.sourceEncoding>Cp1252</project.build.sourceEncoding>
</properties>
<modules>
<module>./P1</module>
<module>./P2</module>
<module>./P3</module>
<module>./P4</module>
<module>./P5Doc</module>
</modules>
</project>
[/XML]

Das P5Doc Verzeichnis soll nicht gebaut sondern eigentlich ein mvn site drauf gemacht werden.
 
Hi,

Ok. und wie sieht die P5Doc pom.xml aus? Was machst Du da?

Man könnte P5Doc seperat über ein Profile steuern....

so in der Art:
Code:
   <modules>
       <module>./P1</module>
       <module>./P2</module>
       <module>./P3</module>
       <module>./P4</module>
   </modules>

  <profiles>
    <profile>
      <id>site</id>
      <modules>
        <module>P5Doc</module>
      </modules>
    </profile>
 </profiles>

ABER: Die Frage ist warum P5Doc überhaupt ausgeführt wird? Was für ein Packaging hast Du gesetzt?

Weiterhin ist die Frage wie Du den build aufrufst?

Code:
mvn clean package
Sollte kein Problem darstellen...für Sachen im Reporting...


Abgesehen davon sind mir ein paar Dinge aufgefallen:

1. Warum ist junit im scope compile und nicht scope test?
2. Warum verwendest Du referenzen außerhalb des aktuellen Projektes (../../checkstyle etc.)
Das macht den Build nicht portable... Abgesehen davon gibt es
für PMD, Checkstyle etc. entsprechende Möglichkeiten das anders zu machen...


Gruß
Karl-Heinz Marbaise
 
[XML]
<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>
<artifactId>XXX</artifactId>
<groupId>de.xxxs</groupId>
<version>0.0.47-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>de.xxx</groupId>
<artifactId>xxx</artifactId>
<packaging>pom</packaging>
<version>0.0.47-SNAPSHOT</version>
<name>xxx</name>
<properties>
<maven-latex-plugin.version>1.2</maven-latex-plugin.version>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>writeVersionnumberToLaTex</id>
<phase>pre-site</phase>
<configuration>
<tasks>
<exec dir="${basedir}" executable="cmd" failonerror="true">
<arg value="/C" />
<arg
value="echo ${project.version} > ${basedir}\src\main\latex\version\version.tex" />
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>


</executions>
</plugin>
<plugin>
<groupId>de.akquinet.jbosscc.latex</groupId>
<artifactId>maven-latex-plugin</artifactId>
<version>${maven-latex-plugin.version}</version>
<configuration>
<settings>

<cleanUp>true</cleanUp>

<!--
all tex main documents in this folder (including subfolders) will
be processed
-->
<texDirectory>${basedir}/src/main/latex</texDirectory>

<!-- the latex command -->
<texCommand>pdflatex</texCommand>
<!-- the bibtex command -->
<bibtexCommand>bibtex</bibtexCommand>

<texCommandArgs>
<texCommandArg>-interaction=nonstopmode</texCommandArg>
<texCommandArg>--src-specials</texCommandArg>
</texCommandArgs>

</settings>
</configuration>
<executions>
<execution>
<phase>site</phase>
<goals>
<goal>latex</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
[/XML]
 
hi,

warum hast Du denn den
Code:
<relativePath>../../pom.xml</relativePath>
drin?

Der verweist ja auf eine POM noch weiter oben...? Sehr komisch?...Warum überhaupt und nicht einfach:

Code:
 <parent>
        <artifactId>XXX</artifactId>
        <groupId>de.xxxs</groupId>
        <version>0.0.47-SNAPSHOT</version>
    </parent>

Abgesehen davon wenn Du auf der Ebene der Parent POM...ich gehe mal von so was hier aus:

Code:
 projekt
  +-- pom.xml (projekt-parent)
  !
  +-- P1
  !      +-- pom.xml (parent: projekt-parent)
  !
  +-- P2
  !      +-- pom.xml (parent: projekt-parent)
  !
  +-- P5Doc
  !      +-- pom.xml (parent: projekt-parent)

So dann ist der Richtige Weg der Aufruf:

Code:
  cd projekt
  mvn clean package
..
  oder 
  mvn site

Weiterhin die Frage warum Du LaTeX zur Dokumentation nutzt ? Ok Ok..DocBook ist auch eine sehr gute alternative und prodoziert auf PDF's ...

Abgesehen davon würde mich interessieren warum Du nicht das Plugin:

LaTeX Maven Plugin - Introduction

verwendest ?

Gruß
Karl-Heinz Marbaise
 
Die Idee das mit mvn latex:latex zu lösen ist ja nicht schlecht das beispiel welches sich auf der Seite befindet funktioniert auch nur leider habe ich eine andere Ordner struktur als es das Plugin zuläßt
 

Neue Themen


Zurück
Oben