mirror of https://github.com/apache/maven.git
PR: MNG-575
Submitted by: Jesse McConnell Reviewed by: Brett Porter Add a way to configure permissions on deployed files git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@290660 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d807f16cdb
commit
3af4a18f48
|
@ -33,6 +33,7 @@ import org.apache.maven.wagon.events.TransferListener;
|
|||
import org.apache.maven.wagon.observers.ChecksumObserver;
|
||||
import org.apache.maven.wagon.proxy.ProxyInfo;
|
||||
import org.apache.maven.wagon.repository.Repository;
|
||||
import org.apache.maven.wagon.repository.RepositoryPermissions;
|
||||
import org.codehaus.plexus.PlexusConstants;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
|
||||
|
@ -63,6 +64,8 @@ public class DefaultWagonManager
|
|||
|
||||
private Map authenticationInfoMap = new HashMap();
|
||||
|
||||
private Map serverPermissionsMap = new HashMap();
|
||||
|
||||
private Map mirrors = new HashMap();
|
||||
|
||||
private TransferListener downloadMonitor;
|
||||
|
@ -139,8 +142,21 @@ public class DefaultWagonManager
|
|||
|
||||
try
|
||||
{
|
||||
wagon.connect( new Repository( repository.getId(), repository.getUrl() ),
|
||||
getAuthenticationInfo( repository.getId() ), getProxy( protocol ) );
|
||||
Repository artifactRepository = new Repository( repository.getId(), repository.getUrl() );
|
||||
|
||||
if ( serverPermissionsMap.containsKey( repository.getId() ) )
|
||||
{
|
||||
RepositoryPermissions perms = (RepositoryPermissions) serverPermissionsMap.get( repository.getId() );
|
||||
getLogger().debug(
|
||||
"adding permissions to wagon connection: " + perms.getFileMode() + " " + perms.getDirectoryMode() );
|
||||
artifactRepository.setPermissions( perms );
|
||||
}
|
||||
else
|
||||
{
|
||||
getLogger().debug( "not adding permissions to wagon connection" );
|
||||
}
|
||||
|
||||
wagon.connect( artifactRepository, getAuthenticationInfo( repository.getId() ), getProxy( protocol ) );
|
||||
|
||||
wagon.put( source, remotePath );
|
||||
|
||||
|
@ -307,6 +323,7 @@ public class DefaultWagonManager
|
|||
|
||||
try
|
||||
{
|
||||
|
||||
wagon.connect( new Repository( repository.getId(), repository.getUrl() ),
|
||||
getAuthenticationInfo( repository.getId() ), getProxy( protocol ) );
|
||||
|
||||
|
@ -593,6 +610,30 @@ public class DefaultWagonManager
|
|||
authenticationInfoMap.put( repositoryId, authInfo );
|
||||
}
|
||||
|
||||
public void addPermissionInfo( String repositoryId, String filePermissions, String directoryPermissions )
|
||||
{
|
||||
|
||||
RepositoryPermissions permissions = new RepositoryPermissions();
|
||||
boolean addPermissions = false;
|
||||
|
||||
if ( filePermissions != null )
|
||||
{
|
||||
permissions.setFileMode( filePermissions );
|
||||
addPermissions = true;
|
||||
}
|
||||
|
||||
if ( directoryPermissions != null )
|
||||
{
|
||||
permissions.setDirectoryMode( directoryPermissions );
|
||||
addPermissions = true;
|
||||
}
|
||||
|
||||
if ( addPermissions )
|
||||
{
|
||||
serverPermissionsMap.put( repositoryId, permissions );
|
||||
}
|
||||
}
|
||||
|
||||
public void addMirror( String id, String mirrorOf, String url )
|
||||
{
|
||||
ArtifactRepository mirror = new DefaultArtifactRepository( id, url, null );
|
||||
|
|
|
@ -66,6 +66,8 @@ public interface WagonManager
|
|||
|
||||
void setDownloadMonitor( TransferListener downloadMonitor );
|
||||
|
||||
void addPermissionInfo( String repositoryId, String filePermissions, String directoryPermissions );
|
||||
|
||||
ProxyInfo getProxy( String protocol );
|
||||
|
||||
AuthenticationInfo getAuthenticationInfo( String id );
|
||||
|
|
|
@ -338,7 +338,7 @@ public class DefaultMaven
|
|||
File file = (File) iterator.next();
|
||||
|
||||
boolean usingReleasePom = false;
|
||||
|
||||
|
||||
if ( RELEASE_POMv4.equals( file.getName() ) )
|
||||
{
|
||||
getLogger().info( "NOTE: Using release-pom: " + file + " in reactor build." );
|
||||
|
@ -369,9 +369,9 @@ public class DefaultMaven
|
|||
for ( Iterator i = project.getModules().iterator(); i.hasNext(); )
|
||||
{
|
||||
String name = (String) i.next();
|
||||
|
||||
|
||||
File moduleFile;
|
||||
|
||||
|
||||
if ( usingReleasePom )
|
||||
{
|
||||
moduleFile = new File( basedir, name + "/" + Maven.RELEASE_POMv4 );
|
||||
|
@ -380,7 +380,7 @@ public class DefaultMaven
|
|||
{
|
||||
moduleFile = new File( basedir, name + "/" + Maven.POMv4 );
|
||||
}
|
||||
|
||||
|
||||
moduleFiles.add( moduleFile );
|
||||
}
|
||||
|
||||
|
@ -475,6 +475,9 @@ public class DefaultMaven
|
|||
|
||||
wagonManager.addAuthenticationInfo( server.getId(), server.getUsername(), server.getPassword(),
|
||||
server.getPrivateKey(), server.getPassphrase() );
|
||||
|
||||
wagonManager.addPermissionInfo( server.getId(), server.getFilePermissions(),
|
||||
server.getDirectoryPermissions() );
|
||||
}
|
||||
|
||||
for ( Iterator i = settings.getMirrors().iterator(); i.hasNext(); )
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
<class>
|
||||
<name>TrackableBase</name>
|
||||
<version>1.0.0</version>
|
||||
<description>common base class that contains code to track the source for this instance (USER|GLOBAL)</description>
|
||||
<description>common base class that contains code to track the source for this instance
|
||||
(USER|GLOBAL)</description>
|
||||
<codeSegments>
|
||||
<codeSegment>
|
||||
<version>1.0.0</version>
|
||||
|
@ -90,7 +91,8 @@
|
|||
<field>
|
||||
<name>usePluginRegistry</name>
|
||||
<version>1.0.0</version>
|
||||
<description><![CDATA[Whether Maven should use the plugin-registry.xml file to manage plugin versions.]]></description>
|
||||
<description>
|
||||
<![CDATA[Whether Maven should use the plugin-registry.xml file to manage plugin versions.]]></description>
|
||||
<type>boolean</type>
|
||||
<defaultValue>true</defaultValue>
|
||||
</field>
|
||||
|
@ -107,7 +109,7 @@
|
|||
<version>1.0.0</version>
|
||||
<required>false</required>
|
||||
<description><![CDATA[Indicate whether maven should operate in offline mode full-time.]]>
|
||||
</description>
|
||||
</description>
|
||||
<type>boolean</type>
|
||||
<defaultValue>false</defaultValue>
|
||||
</field>
|
||||
|
@ -158,8 +160,8 @@
|
|||
<field>
|
||||
<name>mirrors</name>
|
||||
<version>1.0.0</version>
|
||||
<description> Configuration of download mirrors for repositories.
|
||||
</description>
|
||||
<description>Configuration of download mirrors for repositories.
|
||||
</description>
|
||||
<association>
|
||||
<type>Mirror</type>
|
||||
<multiplicity>*</multiplicity>
|
||||
|
@ -192,7 +194,8 @@
|
|||
<field>
|
||||
<name>pluginGroups</name>
|
||||
<version>1.0.0</version>
|
||||
<description>List of groupIds to search for a plugin when that plugin groupId is not explicitly provided.</description>
|
||||
<description>List of groupIds to search for a plugin when that plugin groupId is not explicitly
|
||||
provided.</description>
|
||||
<association>
|
||||
<type>String</type>
|
||||
<multiplicity>*</multiplicity>
|
||||
|
@ -372,7 +375,7 @@
|
|||
<required>false</required>
|
||||
<defaultValue>false</defaultValue>
|
||||
<description><![CDATA[Whether this proxy configuration is the active one.]]>
|
||||
</description>
|
||||
</description>
|
||||
<type>boolean</type>
|
||||
</field>
|
||||
<field>
|
||||
|
@ -426,7 +429,7 @@
|
|||
<name>username</name>
|
||||
<version>1.0.0</version>
|
||||
<description><![CDATA[The username used to authenticate.]]>
|
||||
</description>
|
||||
</description>
|
||||
<type>String</type>
|
||||
</field>
|
||||
<field>
|
||||
|
@ -441,7 +444,7 @@
|
|||
<name>privateKey</name>
|
||||
<version>1.0.0</version>
|
||||
<description><![CDATA[The private key location used to authenticate.]]>
|
||||
</description>
|
||||
</description>
|
||||
<type>String</type>
|
||||
</field>
|
||||
<field>
|
||||
|
@ -452,36 +455,52 @@
|
|||
]]></description>
|
||||
<type>String</type>
|
||||
</field>
|
||||
<field>
|
||||
<name>filePermissions</name>
|
||||
<version>1.0.0</version>
|
||||
<description><![CDATA[
|
||||
The permissions for files when they are created.
|
||||
]]></description>
|
||||
<type>String</type>
|
||||
</field>
|
||||
<field>
|
||||
<name>directoryPermissions</name>
|
||||
<version>1.0.0</version>
|
||||
<description><![CDATA[
|
||||
The permissions for directories when they are created.
|
||||
]]></description>
|
||||
<type>String</type>
|
||||
</field>
|
||||
</fields>
|
||||
</class>
|
||||
<class>
|
||||
<name>Mirror</name>
|
||||
<version>1.0.0</version>
|
||||
<superClass>IdentifiableBase</superClass>
|
||||
<description> A download mirror for a given repository. </description>
|
||||
<description>A download mirror for a given repository.</description>
|
||||
<fields>
|
||||
<field>
|
||||
<name>mirrorOf</name>
|
||||
<required>true</required>
|
||||
<version>1.0.0</version>
|
||||
<type>String</type>
|
||||
<description> The server ID of the repository being mirrored, eg
|
||||
"central". This MUST NOT match the mirror id. </description>
|
||||
<description>The server ID of the repository being mirrored, eg
|
||||
"central". This MUST NOT match the mirror id.</description>
|
||||
</field>
|
||||
<field>
|
||||
<name>name</name>
|
||||
<required>false</required>
|
||||
<version>1.0.0</version>
|
||||
<type>String</type>
|
||||
<description> The optional name that describes the mirror.
|
||||
</description>
|
||||
<description>The optional name that describes the mirror.
|
||||
</description>
|
||||
</field>
|
||||
<field>
|
||||
<name>url</name>
|
||||
<required>true</required>
|
||||
<version>1.0.0</version>
|
||||
<type>String</type>
|
||||
<description> The URL of the mirror repository. </description>
|
||||
<description>The URL of the mirror repository.</description>
|
||||
</field>
|
||||
<!--
|
||||
<field>
|
||||
|
@ -524,7 +543,7 @@
|
|||
</field>
|
||||
<field>
|
||||
<name>properties</name>
|
||||
<description>Extended configuration specific to this profile goes
|
||||
<description>Extended configuration specific to this profile goes
|
||||
here.</description>
|
||||
<type>Properties</type>
|
||||
<association xml.mapStyle="inline">
|
||||
|
@ -536,7 +555,7 @@
|
|||
<name>repositories</name>
|
||||
<version>1.0.0</version>
|
||||
<description><![CDATA[The lists of the remote repositories]]>
|
||||
</description>
|
||||
</description>
|
||||
<association>
|
||||
<type>Repository</type>
|
||||
<multiplicity>*</multiplicity>
|
||||
|
|
Loading…
Reference in New Issue