Author: bentmann Date: Fri May 15 19:17:32 2009 New Revision: 775290 URL: http://svn.apache.org/viewvc?rev=775290&view=rev Log: o Added clear() method to project cache o Added license headers
Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectCache.java maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProjectCache.java maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java maven/components/branches/MNG-2766/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectCache.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectCache.java?rev=775290&r1=775289&r2=775290&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectCache.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectCache.java Fri May 15 19:17:32 2009 @@ -1,5 +1,24 @@ package org.apache.maven.project; +/* + * 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. + */ + import java.util.HashMap; import java.util.Map; @@ -20,7 +39,12 @@ { projectCache.put( key, project ); } - + + public void clear() + { + projectCache.clear(); + } + public int size() { return projectCache.size(); Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProjectCache.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProjectCache.java?rev=775290&r1=775289&r2=775290&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProjectCache.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProjectCache.java Fri May 15 19:17:32 2009 @@ -1,10 +1,36 @@ package org.apache.maven.project; +/* + * 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. + */ + public interface MavenProjectCache { - MavenProject get( String absolutePath ); - void put( String absolutePath, MavenProject project ); - + MavenProject get( String key ); + + void put( String key, MavenProject project ); + + /** + * Clears the cache. + */ + void clear(); + int size(); + } Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java?rev=775290&r1=775289&r2=775290&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java Fri May 15 19:17:32 2009 @@ -5,7 +5,6 @@ import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.model.Profile; -import org.apache.maven.profiles.ProfileManager; public interface ProjectBuilderConfiguration { Modified: maven/components/branches/MNG-2766/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java?rev=775290&r1=775289&r2=775290&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java (original) +++ maven/components/branches/MNG-2766/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java Fri May 15 19:17:32 2009 @@ -38,6 +38,7 @@ import org.apache.maven.model.Model; import org.apache.maven.model.Plugin; import org.apache.maven.project.MavenProject; +import org.apache.maven.project.MavenProjectCache; import org.apache.maven.settings.Profile; import org.apache.maven.settings.Repository; import org.apache.maven.settings.Settings; @@ -241,6 +242,9 @@ assertNull( p0.getProperties().getProperty( "occupation" ) ); + // NOTE: The default cache does not consider profiles so clear it to ensure the project is properly rebuild + mavenEmbedder.getPlexusContainer().lookup( MavenProjectCache.class ).clear(); + // Check with profile activated MavenExecutionRequest request = new DefaultMavenExecutionRequest()