forked from mojohaus/flatten-maven-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set
project.originalModel
after flattening
Based on the discussion in maven-shade-plugin#129 apache/maven-shade-plugin#129 (comment) It seems that the flatten plugin should update the `originalModel` property after we flatten the pom.
- Loading branch information
1 parent
f02b2ad
commit 0480708
Showing
7 changed files
with
157 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Binary file added
BIN
+110 KB
src/it/mrm/repository/org/cudehaus/mojo/flatten/its/core/3.2.1/core-3.2.1.jar
Binary file not shown.
This file contains 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 @@ | ||
invoker.goals=package |
This file contains 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,103 @@ | ||
<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> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>flatten-shaded-drp</artifactId> | ||
<version>0.0.1${rev}-SNAPSHOT</version> | ||
|
||
<properties> | ||
<flatten.its.version>3.2.1</flatten.its.version> | ||
<rev></rev> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<version>16.0.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-archiver</artifactId> | ||
<version>2.5</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<defaultGoal>package</defaultGoal> | ||
|
||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>flatten-maven-plugin</artifactId> | ||
<configuration> | ||
<updatePomFile>true</updatePomFile> | ||
<flattenMode>ossrh</flattenMode> | ||
<embedBuildProfileDependencies>true</embedBuildProfileDependencies> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>flatten</id> | ||
<phase>prepare-package</phase> | ||
<goals> | ||
<goal>flatten</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>3.3.0</version> | ||
<configuration> | ||
<minimizeJar>true</minimizeJar> | ||
<createDependencyReducedPom>true</createDependencyReducedPom> | ||
<artifactSet> | ||
<includes> | ||
<include>com.google.guava:*</include> | ||
</includes> | ||
</artifactSet> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>shade</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<!-- should be removed --> | ||
<profiles> | ||
<profile> | ||
<id>foo</id> | ||
<activation> | ||
<property> | ||
<name>willNotBeActive</name> | ||
</property> | ||
</activation> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>core</artifactId> | ||
<version>${flatten.its.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
|
||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>no-one</id> | ||
<url>@repository.proxy.url@</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
|
||
|
||
</project> |
12 changes: 12 additions & 0 deletions
12
src/it/projects/flatten-shaded-drp/src/main/java/com/example/Main.java
This file contains 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,12 @@ | ||
package com.example; | ||
|
||
import java.util.List; | ||
import com.google.common.collect.ImmutableList; | ||
import org.apache.maven.archiver.MavenArchiver; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
List<Object> l = ImmutableList.of(); | ||
MavenArchiver a = new MavenArchiver(); | ||
} | ||
} |
This file contains 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,38 @@ | ||
/* | ||
* 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 originalPom = new File( basedir, 'pom.xml' ) | ||
assert originalPom.exists() | ||
|
||
def originalProject = new XmlSlurper().parse( originalPom ) | ||
assert 1 == originalProject.dependencies.size() | ||
assert 2 == originalProject.dependencies.dependency.size() | ||
|
||
File flattendPom = new File( basedir, 'dependency-reduced-pom.xml' ) | ||
assert flattendPom.exists() | ||
|
||
def flattendProject = new XmlSlurper().parse( flattendPom ) | ||
assert 1 == flattendProject.dependencies.size() | ||
assert 1 == flattendProject.dependencies.dependency.size() | ||
|
||
def archiver = flattendProject.dependencies.dependency.find { | ||
it.groupId == 'org.apache.maven' && it.artifactId == 'maven-archiver' | ||
} | ||
assert '2.5' == archiver.version.text() | ||
assert 'compile' == archiver.scope.text() | ||
|
This file contains 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