mirror of https://github.com/apache/maven.git
o Added clear() method to project cache
o Added license headers git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@775290 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8674601f3b
commit
b81a59ba3a
|
@ -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;
|
||||
|
||||
|
@ -21,6 +40,11 @@ public class DefaultMavenProjectCache
|
|||
projectCache.put( key, project );
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
projectCache.clear();
|
||||
}
|
||||
|
||||
public int size()
|
||||
{
|
||||
return projectCache.size();
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Properties;
|
|||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.apache.maven.profiles.ProfileManager;
|
||||
|
||||
public interface ProjectBuilderConfiguration
|
||||
{
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.apache.maven.model.Build;
|
|||
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 @@ public class MavenEmbedderTest
|
|||
|
||||
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()
|
||||
|
|
Loading…
Reference in New Issue