-
Notifications
You must be signed in to change notification settings - Fork 113
Add IT using custom plugin repository #497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Marcono1234
wants to merge
5
commits into
mojohaus:master
Choose a base branch
from
Marcono1234:custom-plugin-repo-test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
82a1e47
Add IT using custom plugin repository
Marcono1234 fb06fd5
Use custom local plugin repo instead
Marcono1234 955bc78
Merge remote-tracking branch 'remotes/origin/master' into custom-plug…
Marcono1234 f1417d3
Fix typo in comment
Marcono1234 bb5dafe
Remove check for download message
Marcono1234 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/it/projects/custom-plugin-repository/build-dependency/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?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> | ||
| <relativePath/> | ||
| </parent> | ||
|
|
||
| <artifactId>custom-plugin-repository-build</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version> | ||
| <description> | ||
| Builds a JAR and installs it into a custom local Maven repository | ||
| </description> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-install-plugin</artifactId> | ||
| <executions> | ||
| <execution> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>install-file</goal> | ||
| </goals> | ||
| <configuration> | ||
| <file>${project.build.directory}/${project.build.finalName}.jar</file> | ||
| <localRepositoryPath>${project.basedir}/../custom-repo</localRepositoryPath> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
8 changes: 8 additions & 0 deletions
8
src/it/projects/custom-plugin-repository/build-dependency/src/main/java/example/Main.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package example; | ||
|
|
||
| public class Main | ||
| { | ||
| public static void main( String[] args ) throws Exception { | ||
| System.out.println( "Can you hear me, Major Tom?" ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # First build and install dependency in custom repo | ||
| invoker.project.1 = build-dependency | ||
| invoker.goals.1 = clean package | ||
|
|
||
| # Then try to use dependency from custom repo | ||
| invoker.goals.2 = clean process-resources |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| <?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-use</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> | ||
| <pluginRepository> | ||
| <id>custom-repo</id> | ||
| <!-- Note: On Windows using `project.basedir` includes backslashes in this URI, which is not ideal | ||
| but seems to work --> | ||
| <url>file:///${project.basedir}/custom-repo</url> | ||
| <snapshots> | ||
| <enabled>true</enabled> | ||
| <!-- Test setup does not generate checksum files for artifact --> | ||
| <checksumPolicy>ignore</checksumPolicy> | ||
| </snapshots> | ||
| </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> | ||
| <executableDependency> | ||
| <groupId>org.codehaus.mojo.exec.it</groupId> | ||
| <artifactId>custom-plugin-repository-build</artifactId> | ||
| </executableDependency> | ||
| <mainClass>example.Main</mainClass> | ||
| </configuration> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.codehaus.mojo.exec.it</groupId> | ||
| <artifactId>custom-plugin-repository-build</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version> | ||
| </dependency> | ||
| </dependencies> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /* | ||
| * 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 contain program output | ||
| assert buildLogText.contains('Can you hear me, Major Tom?') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, this leads to something like (note the
\in the path):I think technically this is not a valid
file:URI, but it seems Maven / Java seems to accept it nonetheless.Not sure how this can be easily solved. Using
file:///./custom-repodid not seem to work, maybe because the working directory is actually in one of its parent dirs (or something was wrong with my test setup)?