Install effective POMs into a separate directory
With this patch XMvn MOJO will install raw POMs into /usr/share/maven-poms as this was always done. Additionally effective POMs will be installed into some other location (perhaps /usr/share/maven-fragments) for every non-POM artifact.
This commit is contained in:
parent
e21c3f2abe
commit
e176466b18
84
xmvn-effective-pom.patch
Normal file
84
xmvn-effective-pom.patch
Normal file
@ -0,0 +1,84 @@
|
||||
diff --git a/xmvn-core/src/main/java/org/fedoraproject/maven/Configuration.java b/xmvn-core/src/main/java/org/fedoraproject/maven/Configuration.java
|
||||
index 8c5e8a6..b2996a3 100644
|
||||
--- a/xmvn-core/src/main/java/org/fedoraproject/maven/Configuration.java
|
||||
+++ b/xmvn-core/src/main/java/org/fedoraproject/maven/Configuration.java
|
||||
@@ -114,6 +114,13 @@ public class Configuration
|
||||
return Paths.get( installPomDir );
|
||||
}
|
||||
|
||||
+ private static String installEffectivePomDir = "usr/share/maven-effective-poms";
|
||||
+
|
||||
+ public static Path getInstallEffectivePomDir()
|
||||
+ {
|
||||
+ return Paths.get( installEffectivePomDir );
|
||||
+ }
|
||||
+
|
||||
private static String installDepmapDir = "usr/share/maven-fragments";
|
||||
|
||||
public static Path getInstallDepmapDir()
|
||||
diff --git a/xmvn-mojo/src/main/java/org/fedoraproject/maven/rpminstall/plugin/InstallMojo.java b/xmvn-mojo/src/main/java/org/fedoraproject/maven/rpminstall/plugin/InstallMojo.java
|
||||
index 39a8db4..09e127d 100644
|
||||
--- a/xmvn-mojo/src/main/java/org/fedoraproject/maven/rpminstall/plugin/InstallMojo.java
|
||||
+++ b/xmvn-mojo/src/main/java/org/fedoraproject/maven/rpminstall/plugin/InstallMojo.java
|
||||
@@ -66,7 +66,6 @@ public class InstallMojo
|
||||
|
||||
Path jppGroup;
|
||||
Path jppName;
|
||||
- Path pomFile;
|
||||
DependencyVisitor metadata = targetPackage.getMetadata();
|
||||
|
||||
if ( file != null )
|
||||
@@ -77,11 +76,7 @@ public class InstallMojo
|
||||
+ "\" has unsupported extension. The only supported extension is \".jar\"" );
|
||||
}
|
||||
|
||||
- pomFile = Files.createTempFile( "xmvn-" + artifactId + "-", ".pom.xml" );
|
||||
- DependencyExtractor.simplifyEffectiveModel( project.getModel() );
|
||||
- DependencyExtractor.writeModel( project.getModel(), pomFile );
|
||||
List<Path> extraList = new LinkedList<>();
|
||||
-
|
||||
for ( Rule rule : Configuration.getInstallFiles() )
|
||||
{
|
||||
String name = rule.match( groupId, artifactId, version );
|
||||
@@ -101,10 +96,14 @@ public class InstallMojo
|
||||
targetPackage.addJarFile( file, baseFile, extraList );
|
||||
|
||||
DependencyExtractor.getJavaCompilerTarget( project, metadata );
|
||||
+
|
||||
+ Path effectivePomFile = Files.createTempFile( "xmvn-" + artifactId + "-", ".pom.xml" );
|
||||
+ DependencyExtractor.simplifyEffectiveModel( project.getModel() );
|
||||
+ DependencyExtractor.writeModel( project.getModel(), effectivePomFile );
|
||||
+ targetPackage.addEffectivePomFile( effectivePomFile, jppGroup, jppName );
|
||||
}
|
||||
else
|
||||
{
|
||||
- pomFile = project.getFile().toPath();
|
||||
jppGroup = Paths.get( "JPP" ).resolve( Configuration.getInstallName() );
|
||||
jppName = Paths.get( groupId + "@" + artifactId );
|
||||
|
||||
@@ -112,7 +111,7 @@ public class InstallMojo
|
||||
DependencyExtractor.generateRawRequires( rawModel, metadata );
|
||||
}
|
||||
|
||||
- targetPackage.addPomFile( pomFile, jppGroup, jppName );
|
||||
+ targetPackage.addPomFile( project.getFile().toPath(), jppGroup, jppName );
|
||||
targetPackage.createDepmaps( groupId, artifactId, version, jppGroup, jppName );
|
||||
|
||||
DependencyExtractor.generateEffectiveRuntimeRequires( project.getModel(), metadata );
|
||||
diff --git a/xmvn-mojo/src/main/java/org/fedoraproject/maven/rpminstall/plugin/Package.java b/xmvn-mojo/src/main/java/org/fedoraproject/maven/rpminstall/plugin/Package.java
|
||||
index a228971..2df3434 100644
|
||||
--- a/xmvn-mojo/src/main/java/org/fedoraproject/maven/rpminstall/plugin/Package.java
|
||||
+++ b/xmvn-mojo/src/main/java/org/fedoraproject/maven/rpminstall/plugin/Package.java
|
||||
@@ -86,6 +86,12 @@ public class Package
|
||||
addFile( file, Configuration.getInstallPomDir(), pomName, 0644 );
|
||||
}
|
||||
|
||||
+ public void addEffectivePomFile( Path file, Path jppGroupId, Path jppArtifactId )
|
||||
+ {
|
||||
+ Path pomName = Paths.get( jppGroupId.toString().replace( '/', '.' ) + "-" + jppArtifactId + ".pom" );
|
||||
+ addFile( file, Configuration.getInstallEffectivePomDir(), pomName, 0644 );
|
||||
+ }
|
||||
+
|
||||
private static boolean containsNativeCode( Path jar )
|
||||
throws IOException
|
||||
{
|
@ -1,11 +1,12 @@
|
||||
Name: xmvn
|
||||
Version: 0.3.1
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Local Extensions for Apache Maven
|
||||
License: ASL 2.0
|
||||
URL: http://mizdebsk.fedorapeople.org/xmvn
|
||||
BuildArch: noarch
|
||||
Source0: https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.xz
|
||||
Patch: %{name}-effective-pom.patch
|
||||
|
||||
BuildRequires: maven-local
|
||||
BuildRequires: beust-jcommander
|
||||
@ -31,6 +32,7 @@ This package provides %{summary}.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch -p1
|
||||
|
||||
%build
|
||||
%mvn_file ":{xmvn-{core,connector}}" %{name}/@1 %{_datadir}/%{name}/lib/@1
|
||||
@ -56,6 +58,9 @@ This package provides %{summary}.
|
||||
%doc LICENSE NOTICE
|
||||
|
||||
%changelog
|
||||
* Mon Feb 25 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 0.3.1-2
|
||||
- Install effective POMs into a separate directory
|
||||
|
||||
* Thu Feb 7 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 0.3.1-1
|
||||
- Update to upstream version 0.3.1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user