Maven: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions 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 28: Line 28:
  6  process-resources
  6  process-resources
     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
  7  compile<build>
     Compile the source code of the project.
     Compile the source code of the project.
  8  process-classes
  8  process-classes
Line 35: Line 35:
     Generate any test source code to be included in compilation phase.
     Generate any test source code to be included in compilation phase.
  10 process-test-sources
  10 process-test-sources
  Process the test source code, for example, filter any values.
    Process the test source code, for example, filter any values.
  11 test-compile
  11 test-compile
  Compile the test source code into the test destination directory.
    Compile the test source code into the test destination directory.
  12 process-test-classes
  12 process-test-classes
  Process the generated files from test code file compilation.
    Process the generated files from test code file compilation.
  13 test
  13 test
  Run tests using a suitable unit testing framework (Junit is one).
    Run tests using a suitable unit testing framework (Junit is one).
  14 prepare-package
  14 prepare-package
  Perform any operations necessary to prepare a package before the actual packaging.
    Perform any operations necessary to prepare a package before the actual packaging.
  15 package
  15 package
  Take the compiled code and package it in its distributable format, such as a JAR, WAR, or EAR file.
    Take the compiled code and package it in its distributable format, such as a JAR, WAR, or EAR file.
  16 pre-integration-test
  16 pre-integration-test
  Perform actions required before integration tests are executed. For example, setting up the required environment.
    Perform actions required before integration tests are executed. For example, setting up the required environment.
  17 integration-test
  17 integration-test
  Process and deploy the package if necessary into an environment where integration tests can be run.
    Process and deploy the package if necessary into an environment where integration tests can be run.
  18 post-integration-test
  18 post-integration-test
  Perform actions required after integration tests have been executed. For example, cleaning up the environment.
    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


19
The following error occurred
verify
org.apache.maven.doxia.siterenderer.DocumentContent


Run any check-ups to verify the package is valid and meets quality criteria.
Found the following fix on


20
https://stackoverflow.com/questions/51091539/maven-site-plugins-3-3-java-lang-classnotfoundexception-org-apache-maven-doxia/51528676
install


Install the package into the local repository, which can be used as a dependency in other projects locally.
<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>


21
<build>
deploy
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.7.1</version>
        </plugin>
    </plugins>
</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>