================================== Usefull maven "howtos" and FAQs ================================== .. contents:: How to reduce the process of "install" to run as fast as possible. ------------------------------------------------------------------- Can reduce install execution skiping test execution and compilation, javadoc generation, test signature checking, license checking, and attach sources in jar. mvn -Danimal.sniffer.skip=true -Dsource.skip=true -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -DskipTests -Dgvsig.skip.downloadPluginTemplates=true install How to increment the build number of gvSIG plugins ---------------------------------------------------- To increase the build number of gvSIG plugins, yo can do: mvn -Dincrease-build-number process-sources How to deploy a package of a gvSIG plugin -------------------------------------------- Yo can deploy the package of a gvSIG plugin with: mvn -Ddeploy-package -Duser=USER -Dpassword=PASSWORD install Notes: - Require that the gvsig.package.info.poolURL property that this set to the correct value. - The process uses WEBDAV to upload the packages, gvspkg and gvspki, and require access to write in the location specified by gvsig.package.info.poolURL - If "user" or "password" is not present, the process ask its each time it need. - If folder specified in gvsig.package.info.poolURL does not exist, the process try to create it. - The process create a file "addon-request.txt" in the target with the information to add to the ticket to request the update of the package in the main repository of packages of gvSIG. How show the list of files that have problems with the header. ---------------------------------------------------------------- You can use the mave plugin "license" to check the headers of the files in the project. Use:: mvn -Dlicense.quiet=false license:check How to skip license check from command line ---------------------------------------------- If in the project is enabled by default the checking of the headers of files, you can skip this setting the property "license.skip" to true in the command line:: mvn -Dlicense.skip=true install How to skip attach sources in jar from command line ------------------------------------------------------ If in the project is enabled by default the generation of jar whith the sources of the project, you can disable this setting the property "source.skip" to true in the command line:: mvn -Dsource.skip=true install How to skip test compile from command line -------------------------------------------- You can skip the compilation of test setting the propety "maven.test.skip" to true in the command line:: mvn -Dmaven.test.skip=true install How to skip test execution from command line ---------------------------------------------- You can skip the tests execution setting the propety "skipTests" to true in the command line:: mvn -DskipTests install How to skip javadoc generation from command line -------------------------------------------------- You can skip the javadoc generation setting the property "maven.javadoc.skip" to true in the command line:: mvn -Dmaven.javadoc.skip=true install How to skip test signature cheks from command line --------------------------------------------------- You can skip the signature check setting the property "animal.sniffer.skip" to true in the command line:: mvn -Danimal.sniffer.skip=true install How to install a project without install submodules ---------------------------------------------------------- To install a project with submodules and only install the parent project without submodules use the option "--non-recursive" :: mvn --non-recursive install How to check and fix the header of source files. -------------------------------------------------- You can check the headers of the files in you project using the goal "license". To check the header use:: mvn license:check To fix the header use:: mvn license:format How to skip test compilation -------------------------------- To configure a project to don't run the compilation of test you can add to this pom the next configuration of the plugin "maven-compiler-plugin":: ... org.apache.maven.plugins maven-compiler-plugin default-testCompile process-test-sources testCompile true ... Skip test execution ---------------------- To configure a project to don't run the execution of test you can add to this pom the next configuration of the plugin "maven-surefire-plugin":: ... org.apache.maven.plugins maven-surefire-plugin true ... Continue on test failure ----------------------------- You can configure a project to continue on test execution failure. To do this add to the pom of the project the next configuration of plugin "maven-surefire-plugin" :: ... org.apache.maven.plugins maven-surefire-plugin true ... Set java compatibility -------------------------- To set the compatibility with a java version add to the pom of the project the next configuration of plugin "maven-compiler-plugin" :: ... org.apache.maven.plugins maven-compiler-plugin 1.5 1.5 ISO-8859-1 ... Packaging tests in jar ------------------------ Test classes do not packaging in jar by default. To packing add to pom:: ... org.apache.maven.plugins maven-jar-plugin test-jar **/** ... How to set a dependency with tests jar ----------------------------------------- You can set a dependency with a test jar adding to the declaration of the dependency the scope of test and the type of "test-jar":: ... ... test-jar test How use ant in maven ------------------------- You can use ant embed in the pom of you project. To do this use:: maven-antrun-plugin 1.7 generate-sources Hello world! run Fail when execute "mvn deploy" with "No connector available" ------------------------------------------------------------- When execute a "mvn deploy" fail with the error:: [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project org.gvsig.desktop: Failed to deploy artifacts/metadata: No connector available to access repository gvsig-repository (dav:https://devel.gvsig.org/m2repo/j2se) of type default using the available factories WagonRepositoryConnectorFactory -> [Help 1] [ERROR] This happens to be configured the webdav wagon as an extension in the section "build":: ... org.apache.maven.wagon wagon-webdav-jackrabbit 1.0-beta-7 ... Fail when execute "mvn release: prepare" with "svn command failed... Could not authenticate" ------------------------------------------------------------------------------------------------ When running "mvn release: prepare" updates poms, compiles, and then fails with the following error :: [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.1:prepare (default-cli) on project org.gvsig.desktop: Unable to commit files [ERROR] Provider message: [ERROR] The svn command failed. [ERROR] Command output: [ERROR] svn: Commit failed (details follow): [ERROR] svn: MKACTIVITY of '/svn/gvsig-desktop/!svn/act/931a27bc-57e8-45d9-adcd-5a2cf54a7045': authorization failed: Could not authenticate to server: rejected Basic challenge (https://devel.gvsig.org) [ERROR] -> [Help 1] [ERROR] [ERROR] Apparently maven in linux system use the svn of system and if you're not authenticated when trying to access to the repository, svn fails. This is solved by executing a commit from the command line on some file of the project (only if you have not enabled the option "store-passwords = no" in $ HOME / .subversion / config). For example, you can add or remove at the end of "pom.xml" a blank line and then run from the command line :: svn ci -m "" pom.xml Alternatively can excute:: svn list https://devel.gvsig.org/svn/gvsig-desktop/ And manually accept the certificate permanently. Another option that works on Windows in declaring the user and password in the command: mvn release:prepare -Dusername=[username] -Dpassword=[password] Fail when execute "mvn release:perform" with unable to find valid certification ------------------------------------------------------------------------------------------------ When running "mvn release:perform" fail with unable to find valid certification:: [INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project org.gvsig.tools: Failed to deploy artifacts: Could not transfer artifact org.gvsig:org.gvsig.tools:pom:3.0.15 from/to gvsig-repository (dav:https://devel.gvsig.org/m2repo/j2se): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1] [INFO] [ERROR] [INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging. [INFO] [ERROR] [INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles: [INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException Consulte la seccion "Acceso de escritura al repositorio maven de gvSIG" de http://www.gvsig.org/plone/projects/gvsig-desktop/docs/devel/gvsig-devel-guide/2.0.0/trabajar-con-el-nucleo-de-gvsig/gvsig-compilation/initial-configuration/initial-configuration/?searchterm=maven%20java%20certification