Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ This is the [exec-maven-plugin](http://www.mojohaus.org/exec-maven-plugin/).

## Running integration tests

Execute `mvn -P run-its clean verify`
Execute

```sh
mvn -P run-its clean verify
```

Running a single test:

```sh
mvn -P run-its clean verify "-Dinvoker.test=setup-parent,<TEST-PROJECT-NAME>"
```

## Releasing

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals = clean process-resources
65 changes: 65 additions & 0 deletions src/it/projects/custom-plugin-repository/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.codehaus.mojo.exec.it</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
</parent>

<artifactId>custom-plugin-repository</artifactId>
<version>0.0.1-SNAPSHOT</version>
<description>
Tests executing a JAR which only exists in a custom Maven repository but not in Central
</description>

<pluginRepositories>
<!-- JAR executed by this IT currently only exists in Google Maven repository -->
<pluginRepository>
<id>google</id>
<url>https://maven.google.com</url>
</pluginRepository>
</pluginRepositories>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<addOutputToClasspath>false</addOutputToClasspath>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<!-- Runs R8, see also https://r8.googlesource.com/r8/+/refs/heads/main/README.md -->
<executableDependency>
<groupId>com.android.tools</groupId>
<artifactId>r8</artifactId>
</executableDependency>
<mainClass>com.android.tools.r8.R8</mainClass>
<arguments>
<argument>--version</argument>
</arguments>
</configuration>
<dependencies>
<dependency>
<groupId>com.android.tools</groupId>
<artifactId>r8</artifactId>
<!-- Use old version whose artifact is 'relatively' small -->
<version>2.0.98 </version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
27 changes: 27 additions & 0 deletions src/it/projects/custom-plugin-repository/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

File buildLog = new File(basedir, 'build.log')
assert buildLog.exists()
def buildLogText = buildLog.getText()
// Should have downloaded artifact from custom repository, not from Central
// (requires running `mvn clean ...`)
assert buildLogText.contains('Downloaded from google: https://maven.google.com/com/android/tools/r8/2.0.98/r8-2.0.98.jar')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is testing for the "Downloaded from ..." message here ok, or is that too brittle (e.g. when users don't run mvn clean ... or when this Maven message changes)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can occurs not every time ... when artifact will be cached in local repository we will not have such message

Next issue when we have a version in assertions, we will need update test when artifact will update

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But for the integration tests it uses a separate local Maven repository (under target), right? And that is cleaned when running mvn clean ....

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have removed the check now. You are right, caching seems to be an issue with the current CI setup here.

// Should contain program output
assert buildLogText.contains('R8 2.0.98 (build engineering)')
Loading