Skip to content

5.7 p2use

Pascal Hürlimann edited this page Mar 9, 2020 · 2 revisions

Explanation

This task simplifies the configuration of used p2 repositories. For this purpose, it edits a user's maven settings file, located at ~/.m2/settings.xml. Before exeuction of this task, a backup is always created in the backup folder of the Jazz Development Environment. The info task provides a list of available p2 repositories, and the p2create task is used to create local p2 repositories.

Requirements

The p2use task requires that at least one p2 repository has been created using the p2create task. This can be checked running the Info task.

Example

$ ./gradlew info
...
Available P2 Repository URLs:
        file:/home/sbi/workspaces/jazz/jazz-development-environment/jde/p2repo/6.0.6.1
...

Arguments

p2use takes one parameter, --sdk, for choosing which p2 repository is to be used. Provide the sdk version of the p2 repository you wish to use. Without providing a parameter, p2use will default to the latest p2 repository version.

Detailed Usage

  1. Once you have decided which p2 repository you want to use, you can automatically use this task to configure your maven settings file by running
./gradlew p2use --sdk=VERSION

replacing VERSION by a version of your choice.

Example:

./gradlew p2use --sdk=6.0.6.1

To see the changes this task made, you can compare the latest settings backup in the backup folder with your maven settings file, usually located at ~/.m2/settings.xml

  1. (Optional) If you do not trust the automated editing of your maven files, you can manually make the changes yourself. Run the p2use task with the --out parameter provided:

Example:

gw p2use --sdk=6.0.6.1 --out=console

This will print the entire settings.xml file to the console instead of making any changes. You can use this output as a suggestion of how to make manual edits for yourself.

Example console output:

$ gw p2use --sdk=6.0.6.1 --out=console

> Task :buildSrc:jar
:jar: No valid plugin descriptors were found in META-INF/gradle-plugins

> Task :p2use
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0">
    <profiles>
        <profile>
            <repositories>
                <repository>
                    <id>repo-jde-sdk-6.0.6.1</id>
                    <url>file:/home/sbi/workspaces/jazz/jazz-development-environment/jde/p2repo/6.0.6.1</url>
                    <layout>p2</layout>
                </repository>
            </repositories>
            <id>jde-sdk-6.0.6.1</id>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>jde-sdk-6.0.6.1</activeProfile>
    </activeProfiles>
</settings>

Clone this wiki locally