Maven: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
No edit summary
 
(One intermediate revision by the same user not shown)
Line 15: Line 15:


==Lifecyle==
==Lifecyle==
 
  1  validate
  1  validate
     Validates whether project is correct and all necessary information is available to complete the build process.
     Validates whether project is correct and all necessary information is available to complete the build process.
Line 29: Line 29:
     Copy and process the resources into the destination directory, ready for packaging phase.
     Copy and process the resources into the destination directory, ready for packaging phase.
  7  compile<build>
  7  compile<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.7.1</version>
            </plugin>
<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.7.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>3.0.0</version>
            </plugin>
        </plugins>
    </build>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>3.0.0</version>
            </plugin>
        </plugins>
    </build>
     Compile the source code of the project.
     Compile the source code of the project.
  8  process-classes
  8  process-classes
Line 100: Line 68:
Found the following fix on
Found the following fix on


  https://mkyong.com/maven/mvn-site-java-lang-classnotfoundexception-org-apache-maven-doxia-siterenderer-documentcontent/
  https://stackoverflow.com/questions/51091539/maven-site-plugins-3-3-java-lang-classnotfoundexception-org-apache-maven-doxia/51528676
 
<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>3.0.0</version>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>index</report>
                        <report>licenses</report>
                        <report>dependency-info</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>
    </plugins>
</reporting>


  <build>
  <build>
     <plugins>  
     <plugins>
         <plugin>
         <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-site-plugin</artifactId>
             <artifactId>maven-site-plugin</artifactId>
             <version>3.7.1</version>
             <version>3.7.1</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>3.0.0</version>
         </plugin>
         </plugin>
     </plugins>
     </plugins>
  </build>
  </build>

Latest revision as of 00:53, 13 May 2020

Installation of ubuntu 20.04

Surprise nothing special

apt-get update
apt-get install maven

Set Environment

In ~/.bashrc add

export M2_HOME=/usr/share/maven
export M2=$M2_HOME/bin
export MAVEN_OPTS="-Xms256m -Xmx512m"

You can either log out or run the script with

. ~/.bashrc

Lifecyle

1  validate
   Validates whether project is correct and all necessary information is available to complete the build process.
2  initialize
   Initializes build state, for example set properties.
3  generate-sources
   Generate any source code to be included in compilation phase.
4  process-sources
   Process the source code, for example, filter any value.
5  generate-resources
   Generate resources to be included in the package.
6  process-resources
   Copy and process the resources into the destination directory, ready for packaging phase.
7  compile<build>
   Compile the source code of the project.
8  process-classes
   Post-process the generated files from compilation, for example to do bytecode enhancement/optimization on Java classes.
9  generate-test-sources
   Generate any test source code to be included in compilation phase.
10 process-test-sources
   Process the test source code, for example, filter any values.
11 test-compile
   Compile the test source code into the test destination directory.
12 process-test-classes
   Process the generated files from test code file compilation.
13 test
   Run tests using a suitable unit testing framework (Junit is one).
14 prepare-package
   Perform any operations necessary to prepare a package before the actual packaging.
15 package
   Take the compiled code and package it in its distributable format, such as a JAR, WAR, or EAR file.
16 pre-integration-test
   Perform actions required before integration tests are executed. For example, setting up the required environment.
17 integration-test
   Process and deploy the package if necessary into an environment where integration tests can be run.
18 post-integration-test
   Perform actions required after integration tests have been executed. For example, cleaning up the environment.
19 verify
   Run any check-ups to verify the package is valid and meets quality criteria.
20 install
   Install the package into the local repository, which can be used as a dependency in other projects locally.
21 deploy
   Copies the final package to the remote repository for sharing with other developers and projects.

Tutorial

I followed the tutorial on

https://www.tutorialspoint.com/maven/maven_build_profiles.htm

The following error occurred

org.apache.maven.doxia.siterenderer.DocumentContent

Found the following fix on

https://stackoverflow.com/questions/51091539/maven-site-plugins-3-3-java-lang-classnotfoundexception-org-apache-maven-doxia/51528676
<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>3.0.0</version>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>index</report>
                        <report>licenses</report>
                        <report>dependency-info</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>
    </plugins>
</reporting>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.7.1</version>
        </plugin>
    </plugins>
</build>