This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-site.git
The following commit(s) were added to refs/heads/master by this push: new b04fdfe1 Properly mark source code language b04fdfe1 is described below commit b04fdfe1f8729a9511a94289c1e0fa0e36d1b255 Author: Michael Osipov <micha...@apache.org> AuthorDate: Thu Jan 19 21:53:08 2023 +0100 Properly mark source code language --- content/markdown/configure.md | 4 +- content/markdown/docs/3.2.1/release-notes.md | 2 +- content/markdown/maven-ci-friendly.md | 3 - content/markdown/maven-jsr330.md | 10 +- content/markdown/repositories/artifacts.md | 4 +- content/markdown/settings.md | 326 ++++++++++++++------------- 6 files changed, 182 insertions(+), 167 deletions(-) diff --git a/content/markdown/configure.md b/content/markdown/configure.md index 18615e85..a272522e 100644 --- a/content/markdown/configure.md +++ b/content/markdown/configure.md @@ -82,7 +82,9 @@ clean package` instead of `mvn -T3 -U --fail-at-end clean package` and not to mi Starting with Maven 3.3.1+ you can define JVM configuration via `${maven.projectBasedir}/.mvn/jvm.config` file which means you can define the options for your build on a per project base. This file will become part of your project and will be checked in along with your project. So no need anymore for `MAVEN_OPTS`, `.mavenrc` files. So for example if you put the following JVM options into the `${maven.projectBasedir}/.mvn/jvm.config` file - -Xmx2048m -Xms1024m -XX:MaxPermSize=512m -Djava.awt.headless=true +``` +-Xmx2048m -Xms1024m -XX:MaxPermSize=512m -Djava.awt.headless=true +``` You don't need to use these options in `MAVEN_OPTS` or switch between different configurations. diff --git a/content/markdown/docs/3.2.1/release-notes.md b/content/markdown/docs/3.2.1/release-notes.md index ee50578a..0d15e3d8 100644 --- a/content/markdown/docs/3.2.1/release-notes.md +++ b/content/markdown/docs/3.2.1/release-notes.md @@ -50,7 +50,7 @@ The full list of changes can be found in our [issue management system][4]. It is sometimes useful to clip a dependency's transitive dependencies. A dependency may have incorrectly specified scopes, or dependencies that conflict with other dependencies in your project. Using wildcard excludes makes it easy to exclude all a dependency's transitive dependencies. In the case below you may be working with the maven-embedder and you want to manage the dependencies you use yourself, so you clip all the transitive dependencies: -``` +```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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> ... diff --git a/content/markdown/maven-ci-friendly.md b/content/markdown/maven-ci-friendly.md index e6976a13..5ec7225d 100644 --- a/content/markdown/maven-ci-friendly.md +++ b/content/markdown/maven-ci-friendly.md @@ -326,7 +326,4 @@ mvn -Drevision=2.7.8 -Dchangelist= clean package </project> ``` - - [flatten-maven-plugin]: https://www.mojohaus.org/flatten-maven-plugin/ - diff --git a/content/markdown/maven-jsr330.md b/content/markdown/maven-jsr330.md index 4b20be27..402f12d1 100644 --- a/content/markdown/maven-jsr330.md +++ b/content/markdown/maven-jsr330.md @@ -52,7 +52,7 @@ you want made available to Maven. The `sisu-maven-plugin` creates its index in ` If you take a look in that file with the example from the next paragraph, you will see something like the following: -``` +```java org.apache.maven.lifecycle.profiler.LifecycleProfiler org.apache.maven.lifecycle.profiler.internal.DefaultSessionProfileRenderer org.apache.maven.lifecycle.profiler.internal.DefaultTimer @@ -72,7 +72,7 @@ If you want to look at the full implementation, you can find it [here][tesla-pro Ok, so let\'s take a look at the POM: -``` +```xml <?xml version="1.0"?> <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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> @@ -127,7 +127,7 @@ the JSR-330 component index. When you build and place the extension JAR in the ` it will automatically get picked up by Maven. In the case of this example, we have an implementation of an `EventSpy` that times the executions of individual mojos within a phase in the lifecycle. -``` +```java package org.apache.maven.lifecycle.profiler; import javax.inject.Inject; @@ -224,7 +224,7 @@ Let\'s take a look at an example plugin. The POM is setup in a similar way to an to `maven-plugin-api` and `maven-plugin-annotations` to extend the `AbstractMojo` and use the Java 5 plugin annotations in our example. -``` +```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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -316,7 +316,7 @@ to instantiate the `Mojo`. In this simple case, you can actually test this plugi testing harness because you can instantiate the `Jsr330Component` and `Jsr330Mojo` directly and wire everything up manually using the constructor. Constructor injection, which Plexus lacks, greatly simplifies testing. -``` +```java package org.apache.maven.plugins; import javax.inject.Inject; diff --git a/content/markdown/repositories/artifacts.md b/content/markdown/repositories/artifacts.md index 67940bb7..4e90109a 100644 --- a/content/markdown/repositories/artifacts.md +++ b/content/markdown/repositories/artifacts.md @@ -133,7 +133,7 @@ Also, this has "interesting" consequences, consider for example following Artifa `org.project:reusable-test-support:1.0:tests:jar`. With type handlers above, maybe surprisingly, the dependency to this very same artifact can be described in two ways: -``` +```xml <dependency> <groupId>org.project</groupId> <artifactId>reusable-test-support</artifactId> @@ -144,7 +144,7 @@ this very same artifact can be described in two ways: and the equivalent dependency would be: -``` +```xml <dependency> <groupId>org.project</groupId> <artifactId>reusable-test-support</artifactId> diff --git a/content/markdown/settings.md b/content/markdown/settings.md index 3759fc59..ab7826f1 100644 --- a/content/markdown/settings.md +++ b/content/markdown/settings.md @@ -64,19 +64,19 @@ your needs. Here is an overview of the top elements under `settings`: -``` - <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> - <localRepository/> - <interactiveMode/> - <offline/> - <pluginGroups/> - <servers/> - <mirrors/> - <proxies/> - <profiles/> - <activeProfiles/> - </settings> +```xml +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> + <localRepository/> + <interactiveMode/> + <offline/> + <pluginGroups/> + <servers/> + <mirrors/> + <proxies/> + <profiles/> + <activeProfiles/> +</settings> ``` The contents of the `settings.xml` can be interpolated using the @@ -123,14 +123,16 @@ groupId. The list is searched when a plugin is used and the groupId is not provided in the command line. This list automatically contains `org.apache.maven.plugins` and `org.codehaus.mojo`. - <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> - ... - <pluginGroups> - <pluginGroup>org.eclipse.jetty</pluginGroup> - </pluginGroups> - ... - </settings> +```xml +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> + ... + <pluginGroups> + <pluginGroup>org.eclipse.jetty</pluginGroup> + </pluginGroups> + ... +</settings> +``` For example, given the above settings the Maven command line may execute `org.eclipse.jetty:jetty-maven-plugin:run` with the truncated command: @@ -146,23 +148,25 @@ of the POM. However, certain settings such as `username` and `password` should not be distributed along with the `pom.xml`. This type of information should exist on the build server in the `settings.xml`. - <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> - ... - <servers> - <server> - <id>server001</id> - <username>my_login</username> - <password>my_password</password> - <privateKey>${user.home}/.ssh/id_dsa</privateKey> - <passphrase>some_passphrase</passphrase> - <filePermissions>664</filePermissions> - <directoryPermissions>775</directoryPermissions> - <configuration></configuration> - </server> - </servers> - ... - </settings> +```xml +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> + ... + <servers> + <server> + <id>server001</id> + <username>my_login</username> + <password>my_password</password> + <privateKey>${user.home}/.ssh/id_dsa</privateKey> + <passphrase>some_passphrase</passphrase> + <filePermissions>664</filePermissions> + <directoryPermissions>775</directoryPermissions> + <configuration></configuration> + </server> + </servers> + ... +</settings> +``` - **id**: This is the ID of the server *(not of the user to login as)* that matches the `id` element of the repository/mirror that Maven @@ -191,19 +195,21 @@ page](./guides/mini/guide-encryption.html) ### Mirrors - <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> - ... - <mirrors> - <mirror> - <id>planetmirror.com</id> - <name>PlanetMirror Australia</name> - <url>http://downloads.planetmirror.com/pub/maven2</url> - <mirrorOf>central</mirrorOf> - </mirror> - </mirrors> - ... - </settings> +```xml +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> + ... + <mirrors> + <mirror> + <id>planetmirror.com</id> + <name>PlanetMirror Australia</name> + <url>http://downloads.planetmirror.com/pub/maven2</url> + <mirrorOf>central</mirrorOf> + </mirror> + </mirrors> + ... +</settings> +```xml - **id**, **name**: The unique identifier and user-friendly name of this mirror. The `id` is used to differentiate between `mirror` @@ -223,23 +229,25 @@ Mirror Settings](./guides/mini/guide-mirror-settings.html). ### Proxies - <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> - ... - <proxies> - <proxy> - <id>myproxy</id> - <active>true</active> - <protocol>http</protocol> - <host>proxy.somewhere.com</host> - <port>8080</port> - <username>proxyuser</username> - <password>somepassword</password> - <nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts> - </proxy> - </proxies> - ... - </settings> +```xml +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> + ... + <proxies> + <proxy> + <id>myproxy</id> + <active>true</active> + <protocol>http</protocol> + <host>proxy.somewhere.com</host> + <port>8080</port> + <username>proxyuser</username> + <password>somepassword</password> + <nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts> + </proxy> + </proxies> + ... +</settings> +```xml - **id**: The unique identifier for this proxy. This is used to differentiate between `proxy` elements. @@ -275,35 +283,37 @@ of a profile comes from its ability to modify some values only under certain circumstances; those circumstances are specified via an `activation` element. - <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> +```xml +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> + ... + <profiles> + <profile> + <id>test</id> + <activation> + <activeByDefault>false</activeByDefault> + <jdk>1.5</jdk> + <os> + <name>Windows XP</name> + <family>Windows</family> + <arch>x86</arch> + <version>5.1.2600</version> + </os> + <property> + <name>mavenVersion</name> + <value>2.0.3</value> + </property> + <file> + <exists>${basedir}/file2.properties</exists> + <missing>${basedir}/file1.properties</missing> + </file> + </activation> ... - <profiles> - <profile> - <id>test</id> - <activation> - <activeByDefault>false</activeByDefault> - <jdk>1.5</jdk> - <os> - <name>Windows XP</name> - <family>Windows</family> - <arch>x86</arch> - <version>5.1.2600</version> - </os> - <property> - <name>mavenVersion</name> - <value>2.0.3</value> - </property> - <file> - <exists>${basedir}/file2.properties</exists> - <missing>${basedir}/file1.properties</missing> - </file> - </activation> - ... - </profile> - </profiles> - ... - </settings> + </profile> + </profiles> + ... +</settings> +```xml Activation occurs when all specified criteria have been met, though not all are required at once. @@ -362,20 +372,22 @@ all accessible from the `settings.xml` file: <!-- --> - <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> +```xml +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> + ... + <profiles> + <profile> ... - <profiles> - <profile> - ... - <properties> - <user.install>${user.home}/our-project</user.install> - </properties> - ... - </profile> - </profiles> + <properties> + <user.install>${user.home}/our-project</user.install> + </properties> ... - </settings> + </profile> + </profiles> + ... +</settings> +```xml The property `${user.install}` is accessible from a POM if this profile is active. @@ -389,48 +401,50 @@ remote repositories may contain different projects, and under the active profile they may be searched for a matching release or snapshot artifact. - <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> +```xml +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> + ... + <profiles> + <profile> ... - <profiles> - <profile> - ... - <repositories> - <repository> - <id>codehausSnapshots</id> - <name>Codehaus Snapshots</name> - <releases> - <enabled>false</enabled> - <updatePolicy>always</updatePolicy> - <checksumPolicy>warn</checksumPolicy> - </releases> - <snapshots> - <enabled>true</enabled> - <updatePolicy>never</updatePolicy> - <checksumPolicy>fail</checksumPolicy> - </snapshots> - <url>http://snapshots.maven.codehaus.org/maven2</url> - <layout>default</layout> - </repository> - </repositories> - <pluginRepositories> - <pluginRepository> - <id>myPluginRepo</id> - <name>My Plugins repo</name> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - <url>https://maven-central-eu....com/maven2/</url> - </pluginRepository> - </pluginRepositories> - ... - </profile> - </profiles> + <repositories> + <repository> + <id>codehausSnapshots</id> + <name>Codehaus Snapshots</name> + <releases> + <enabled>false</enabled> + <updatePolicy>always</updatePolicy> + <checksumPolicy>warn</checksumPolicy> + </releases> + <snapshots> + <enabled>true</enabled> + <updatePolicy>never</updatePolicy> + <checksumPolicy>fail</checksumPolicy> + </snapshots> + <url>http://snapshots.maven.codehaus.org/maven2</url> + <layout>default</layout> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>myPluginRepo</id> + <name>My Plugins repo</name> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + <url>https://maven-central-eu....com/maven2/</url> + </pluginRepository> + </pluginRepositories> ... - </settings> + </profile> + </profiles> + ... +</settings> +```xml - **releases**, **snapshots**: These are the policies for each type of artifact, Release or snapshot. With these two sets, a POM has the @@ -468,13 +482,15 @@ Maven can find new plugins. ### Active Profiles - <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> - ... - <activeProfiles> - <activeProfile>env-test</activeProfile> - </activeProfiles> - </settings> +```xml +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> + ... + <activeProfiles> + <activeProfile>env-test</activeProfile> + </activeProfiles> +</settings> +```xml The final piece of the `settings.xml` puzzle is the `activeProfiles` element. This contains a set of `activeProfile` elements, which each