maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject svn commit: r1481390 - in /maven/shared/trunk/maven-project-utils/src: it/multimodule-profile/ it/multimodule-profile/module/ main/java/org/apache/maven/shared/project/utils/
Date Sat, 11 May 2013 18:49:42 GMT
Author: rfscholte
Date: Sat May 11 18:49:42 2013
New Revision: 1481390

URL: http://svn.apache.org/r1481390
Log:
Solve issue with modules which aren't part of the reactor

Added:
    maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/
    maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/invoker.properties
    maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/module/
    maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/module/pom.xml
    maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/pom.xml
    maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/verify.groovy
Modified:
    maven/shared/trunk/maven-project-utils/src/main/java/org/apache/maven/shared/project/utils/ProjectUtils.java

Added: maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/invoker.properties
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/invoker.properties?rev=1481390&view=auto
==============================================================================
--- maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/invoker.properties (added)
+++ maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/invoker.properties Sat
May 11 18:49:42 2013
@@ -0,0 +1,2 @@
+invoker.goals = org.apache.maven.shared.project.utils.it:maven-projectutils-plugin:resolve-project
+invoker.project = module/pom.xml
\ No newline at end of file

Added: maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/module/pom.xml
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/module/pom.xml?rev=1481390&view=auto
==============================================================================
--- maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/module/pom.xml (added)
+++ maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/module/pom.xml Sat May
11 18:49:42 2013
@@ -0,0 +1,12 @@
+<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.apache.maven.shared.project.utils.it.profile-module</groupId>
+    <artifactId>profile</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>module</artifactId>
+  <packaging>pom</packaging>
+  
+</project>
\ No newline at end of file

Added: maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/pom.xml
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/pom.xml?rev=1481390&view=auto
==============================================================================
--- maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/pom.xml (added)
+++ maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/pom.xml Sat May 11 18:49:42
2013
@@ -0,0 +1,28 @@
+<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.apache.maven.shared.project.utils.it.profile-module</groupId>
+  <artifactId>profile</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  
+  <distributionManagement>
+    <site>
+      <url>http://localhost/profile</url>
+    </site>
+  </distributionManagement>
+  
+  <scm>
+    <connection>scm:local:/project</connection>
+    <developerConnection>scm:local:/sproject</developerConnection>
+  </scm>
+  
+  <profiles>
+    <profile>
+      <id>profile</id>
+      <modules>
+        <module>module</module>
+      </modules>
+    </profile>
+  </profiles>
+</project>
\ No newline at end of file

Added: maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/verify.groovy
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/verify.groovy?rev=1481390&view=auto
==============================================================================
--- maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/verify.groovy (added)
+++ maven/shared/trunk/maven-project-utils/src/it/multimodule-profile/verify.groovy Sat May
11 18:49:42 2013
@@ -0,0 +1,21 @@
+/*
+ * 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.text.contains( '[INFO] org.apache.maven.shared.project.utils.it.profile-module:module:pom:0.0.1-SNAPSHOT
is root project: false' )
+assert buildLog.text.contains( '[INFO] org.apache.maven.shared.project.utils.it.profile-module:module:pom:0.0.1-SNAPSHOT
is aggregator: false' )

Modified: maven/shared/trunk/maven-project-utils/src/main/java/org/apache/maven/shared/project/utils/ProjectUtils.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-project-utils/src/main/java/org/apache/maven/shared/project/utils/ProjectUtils.java?rev=1481390&r1=1481389&r2=1481390&view=diff
==============================================================================
--- maven/shared/trunk/maven-project-utils/src/main/java/org/apache/maven/shared/project/utils/ProjectUtils.java
(original)
+++ maven/shared/trunk/maven-project-utils/src/main/java/org/apache/maven/shared/project/utils/ProjectUtils.java
Sat May 11 18:49:42 2013
@@ -1,5 +1,6 @@
 package org.apache.maven.shared.project.utils;
 
+import java.io.File;
 import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -64,10 +65,21 @@ public final class ProjectUtils
             }
         }
         
-        if ( parent.getModules().size() > 0 )
+        // problem: parent has modules, but they aren't collected (ie not in the reactor)
+        // (not) being a rootProject must never depend on reactor projects or active profiles
+        for ( String module : getAllModules( parent ).keySet() )
         {
-            // problem: parent has modules, but they aren't collected (ie not in the reactor)
-            // can't really tell if current project is root or not
+            File moduleFile = new File( parent.getBasedir(), module );
+            if ( moduleFile.isDirectory() )
+            {
+                moduleFile = new File( moduleFile, "pom.xml" );
+            }
+
+            if ( moduleFile.equals( project.getFile() ) )
+            {
+                // project is a module of its parent
+                return false;
+            }
         }
 
         // project isn't a module of its parent



Mime
View raw message