mirror of
https://github.com/Alfresco/alfresco-sdk.git
synced 2025-05-19 17:15:24 +00:00
Added support for existing file-mapping.properties and ability to specify location through mFileMappingProperties configuration
Update issue 5 Update issue 39 Update issue 53 git-svn-id: http://maven-alfresco-archetypes.googlecode.com/svn/trunk@497 04253f4f-3451-0410-a141-5562f1e59037
This commit is contained in:
parent
ac87c8ef7a
commit
1c0056e6b2
@ -231,7 +231,7 @@ public abstract class AbstractAmpMojo extends AbstractMojo
|
|||||||
Overlay overlay = (Overlay) it.next();
|
Overlay overlay = (Overlay) it.next();
|
||||||
if ( overlay.isCurrentProject() )
|
if ( overlay.isCurrentProject() )
|
||||||
{
|
{
|
||||||
packagingTasks.add( new AmpProjectPackagingTask( mAmpResources, mModuleProperties) );
|
packagingTasks.add( new AmpProjectPackagingTask( mAmpResources, mModuleProperties, mFileMappingProperties) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -333,6 +333,12 @@ public abstract class AbstractAmpMojo extends AbstractMojo
|
|||||||
*/
|
*/
|
||||||
private File mModuleProperties;
|
private File mModuleProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path to the web.xml file to use.
|
||||||
|
*
|
||||||
|
* @parameter expression="${maven.amp.fileMappingProperties}" default-value="${project.basedir}/file-mapping.properties"
|
||||||
|
*/
|
||||||
|
private File mFileMappingProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directory to unpack dependent AMPs into if needed
|
* Directory to unpack dependent AMPs into if needed
|
||||||
@ -661,6 +667,16 @@ public abstract class AbstractAmpMojo extends AbstractMojo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public File getmFileMappingProperties()
|
||||||
|
{
|
||||||
|
return mFileMappingProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setmFileMappingProperties(File mFileMappingProperties)
|
||||||
|
{
|
||||||
|
this.mFileMappingProperties = mFileMappingProperties;
|
||||||
|
}
|
||||||
|
|
||||||
public String getOutputFileNameMapping()
|
public String getOutputFileNameMapping()
|
||||||
{
|
{
|
||||||
return mOutputFileNameMapping;
|
return mOutputFileNameMapping;
|
||||||
|
@ -45,16 +45,19 @@ public class AmpProjectPackagingTask
|
|||||||
|
|
||||||
private final File moduleProperties;
|
private final File moduleProperties;
|
||||||
|
|
||||||
|
private final File fileMappingProperties;
|
||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
|
|
||||||
|
|
||||||
public AmpProjectPackagingTask( Resource[] webResources, File moduleProperties)
|
public AmpProjectPackagingTask( Resource[] webResources, File moduleProperties, File fileMappingProperties)
|
||||||
{
|
{
|
||||||
if ( webResources != null )
|
if ( webResources != null )
|
||||||
{
|
{
|
||||||
this.webResources = webResources;
|
this.webResources = webResources;
|
||||||
}
|
}
|
||||||
this.moduleProperties = moduleProperties;
|
this.moduleProperties = moduleProperties;
|
||||||
|
this.fileMappingProperties = fileMappingProperties;
|
||||||
this.id = Overlay.currentProjectInstance().getId();
|
this.id = Overlay.currentProjectInstance().getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +170,17 @@ public class AmpProjectPackagingTask
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File fileMapping = new File(context.getAmpDirectory(), FILE_MAPPING);
|
if ( fileMappingProperties != null && StringUtils.isNotEmpty( fileMappingProperties.getName() ) )
|
||||||
|
{
|
||||||
|
if ( fileMappingProperties.exists() )
|
||||||
|
{
|
||||||
|
context.getLog().info("Existing " + FILE_MAPPING + " found, performing property expansion");
|
||||||
|
copyFilteredFile(id, context, fileMappingProperties, FILE_MAPPING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
File fileMapping = new File(context.getAmpDirectory(), FILE_MAPPING);
|
||||||
|
context.getLog().info("No " + FILE_MAPPING + " found, synthesizing one");
|
||||||
OutputStream out = null;
|
OutputStream out = null;
|
||||||
|
|
||||||
fileMapping.createNewFile(); // Note: ignore if the file already exists - we simply overwrite its existing contents
|
fileMapping.createNewFile(); // Note: ignore if the file already exists - we simply overwrite its existing contents
|
||||||
|
Loading…
x
Reference in New Issue
Block a user