diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/pom.xml b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/pom.xml index d17eb640..25eef2c2 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/pom.xml +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/pom.xml @@ -287,56 +287,191 @@ + + org.codehaus.gmaven + gmaven-plugin + 1.5 + + + check-js-files-inside-assembly + generate-resources + + execute + + + + def dirPath = "${project.basedir}/src/main/assembly/web" // Replace with your directory path + def dirExists = new File(dirPath).isDirectory() + + if (dirExists) + { + def jsFilesExist = checkForJsFiles(new File(dirPath)) + + if (jsFilesExist) { + // Execute the minify step here or set a property to control it. + // For example, you can set a property to true to indicate that minification is required. + project.properties['minifyRequiredInAssembly'] = 'false' + println "JavaScript files found. Minification is required." + } else { + project.properties['minifyRequiredInAssembly'] = 'true' + println "No JavaScript files found. Skipping minification." + } + + } + else{ + project.properties['minifyRequiredInAssembly'] = 'true' + } + + def checkForJsFiles(File directory) { + def jsFilesExist = false + directory.eachFileRecurse { file -> + if (file.name.endsWith('.js') && !matchesExclusionPatterns(file.path)) { + jsFilesExist = true + } + } + jsFilesExist + } + + def matchesExclusionPatterns(filePath) { + def exclusionPatterns = [ + 'webscripts', + 'site-webscripts', + 'META-INF', + '.*/.lib/.js', + '.*/.css', + '.*/.min/js', + '.*/.min/.css' + ] + return exclusionPatterns.any { pattern -> filePath =~ /.*\/$pattern\/.*/ } + } + + + + + check-js-files-inside-resources + generate-resources + + execute + + + + def dirPath = "${project.basedir}/src/main/resources" // Replace with your directory path + def dirExists = new File(dirPath).isDirectory() + + if (dirExists) + { + def jsFilesExist = checkForJsFiles(new File(dirPath)) + + if (jsFilesExist) { + // Execute the minify step here or set a property to control it. + // For example, you can set a property to true to indicate that minification is required. + project.properties['minifyRequiredInResources'] = 'false' + println "JavaScript files found. Minification is required." + } else { + project.properties['minifyRequiredInResources'] = 'true' + println "No JavaScript files found. Skipping minification." + } + + } + else{ + project.properties['minifyRequiredInResources'] = 'true' + } + + def checkForJsFiles(File directory) { + def jsFilesExist = false + directory.eachFileRecurse { file -> + if (file.name.endsWith('.js') && !matchesExclusionPatterns(file.path)) { + jsFilesExist = true + } + } + jsFilesExist + } + + def matchesExclusionPatterns(filePath) { + def exclusionPatterns = [ + 'webscripts', + 'META-INF', + '.*/.lib/.js', + '.*/.css', + '.*/.min/js', + '.*/.min/.css' + ] + return exclusionPatterns.any { pattern -> filePath =~ /.*\/$pattern\/.*/ } + } + + + + + + + - net.alchim31.maven - yuicompressor-maven-plugin - 1.5.1 + com.github.blutorange + closure-compiler-maven-plugin + 2.27.0 compress-assembly + generate-resources - compress + minify - ${project.basedir}/src/main/assembly/web - ${project.basedir}/src/main/assembly/web + ${project.basedir}/src/main/assembly + ${project.basedir}/src/main/assembly + web + web + true + ${minifyRequiredInAssembly} + + **/*.js + **/webscripts/** **/site-webscripts/** **/META-INF/** **/*.lib.js **/*.css - **/*-min.js - **/*-min.css + **/*.min.js + **/*.min.css true - false compress-resources + generate-resources - compress + minify + ${project.basedir}/src/main + ${project.basedir}/src/main + resources + resources + true + ${minifyRequiredInResources} + + **/*.js + **/webscripts/** **/site-webscripts/** **/*.lib.js **/*.css - **/*-min.js - **/*-min.css + **/*.min.js + **/*.min.css true - false + org.zeroturnaround diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/pom.xml b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/pom.xml index 85aa0bda..601e6421 100644 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/pom.xml +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/pom.xml @@ -355,56 +355,191 @@ + + org.codehaus.gmaven + gmaven-plugin + 1.5 + + + check-js-files-inside-assembly + generate-resources + + execute + + + + def dirPath = "${project.basedir}/src/main/assembly/web" // Replace with your directory path + def dirExists = new File(dirPath).isDirectory() + + if (dirExists) + { + def jsFilesExist = checkForJsFiles(new File(dirPath)) + + if (jsFilesExist) { + // Execute the minify step here or set a property to control it. + // For example, you can set a property to true to indicate that minification is required. + project.properties['minifyRequiredInAssembly'] = 'false' + println "JavaScript files found. Minification is required." + } else { + project.properties['minifyRequiredInAssembly'] = 'true' + println "No JavaScript files found. Skipping minification." + } + + } + else{ + project.properties['minifyRequiredInAssembly'] = 'true' + } + + def checkForJsFiles(File directory) { + def jsFilesExist = false + directory.eachFileRecurse { file -> + if (file.name.endsWith('.js') && !matchesExclusionPatterns(file.path)) { + jsFilesExist = true + } + } + jsFilesExist + } + + def matchesExclusionPatterns(filePath) { + def exclusionPatterns = [ + 'webscripts', + 'site-webscripts', + 'META-INF', + '.*/.lib/.js', + '.*/.css', + '.*/.min/js', + '.*/.min/.css' + ] + return exclusionPatterns.any { pattern -> filePath =~ /.*\/$pattern\/.*/ } + } + + + + + check-js-files-inside-resources + generate-resources + + execute + + + + def dirPath = "${project.basedir}/src/main/resources" // Replace with your directory path + def dirExists = new File(dirPath).isDirectory() + + if (dirExists) + { + def jsFilesExist = checkForJsFiles(new File(dirPath)) + + if (jsFilesExist) { + // Execute the minify step here or set a property to control it. + // For example, you can set a property to true to indicate that minification is required. + project.properties['minifyRequiredInResources'] = 'false' + println "JavaScript files found. Minification is required." + } else { + project.properties['minifyRequiredInResources'] = 'true' + println "No JavaScript files found. Skipping minification." + } + + } + else{ + project.properties['minifyRequiredInResources'] = 'true' + } + + def checkForJsFiles(File directory) { + def jsFilesExist = false + directory.eachFileRecurse { file -> + if (file.name.endsWith('.js') && !matchesExclusionPatterns(file.path)) { + jsFilesExist = true + } + } + jsFilesExist + } + + def matchesExclusionPatterns(filePath) { + def exclusionPatterns = [ + 'webscripts', + 'META-INF', + '.*/.lib/.js', + '.*/.css', + '.*/.min/js', + '.*/.min/.css' + ] + return exclusionPatterns.any { pattern -> filePath =~ /.*\/$pattern\/.*/ } + } + + + + + + + - net.alchim31.maven - yuicompressor-maven-plugin - 1.5.1 + com.github.blutorange + closure-compiler-maven-plugin + 2.27.0 compress-assembly + generate-resources - compress + minify - ${project.basedir}/src/main/assembly/web - ${project.basedir}/src/main/assembly/web + ${project.basedir}/src/main/assembly + ${project.basedir}/src/main/assembly + web + web + true + ${minifyRequiredInAssembly} + + **/*.js + **/webscripts/** **/site-webscripts/** **/META-INF/** **/*.lib.js **/*.css - **/*-min.js - **/*-min.css + **/*.min.js + **/*.min.css true - false compress-resources + generate-resources - compress + minify + ${project.basedir}/src/main + ${project.basedir}/src/main + resources + resources + true + ${minifyRequiredInResources} + + **/*.js + **/webscripts/** **/site-webscripts/** **/*.lib.js **/*.css - **/*-min.js - **/*-min.css + **/*.min.js + **/*.min.css true - false + org.zeroturnaround diff --git a/archetypes/alfresco-share-jar-archetype/src/main/resources/archetype-resources/pom.xml b/archetypes/alfresco-share-jar-archetype/src/main/resources/archetype-resources/pom.xml index fd7972e0..7de5cbf1 100644 --- a/archetypes/alfresco-share-jar-archetype/src/main/resources/archetype-resources/pom.xml +++ b/archetypes/alfresco-share-jar-archetype/src/main/resources/archetype-resources/pom.xml @@ -221,56 +221,191 @@ + + org.codehaus.gmaven + gmaven-plugin + 1.5 + + + check-js-files-inside-assembly + generate-resources + + execute + + + + def dirPath = "${project.basedir}/src/main/assembly/web" // Replace with your directory path + def dirExists = new File(dirPath).isDirectory() + + if (dirExists) + { + def jsFilesExist = checkForJsFiles(new File(dirPath)) + + if (jsFilesExist) { + // Execute the minify step here or set a property to control it. + // For example, you can set a property to true to indicate that minification is required. + project.properties['minifyRequiredInAssembly'] = 'false' + println "JavaScript files found. Minification is required." + } else { + project.properties['minifyRequiredInAssembly'] = 'true' + println "No JavaScript files found. Skipping minification." + } + + } + else{ + project.properties['minifyRequiredInAssembly'] = 'true' + } + + def checkForJsFiles(File directory) { + def jsFilesExist = false + directory.eachFileRecurse { file -> + if (file.name.endsWith('.js') && !matchesExclusionPatterns(file.path)) { + jsFilesExist = true + } + } + jsFilesExist + } + + def matchesExclusionPatterns(filePath) { + def exclusionPatterns = [ + 'webscripts', + 'site-webscripts', + 'META-INF', + '.*/.lib/.js', + '.*/.css', + '.*/.min/js', + '.*/.min/.css' + ] + return exclusionPatterns.any { pattern -> filePath =~ /.*\/$pattern\/.*/ } + } + + + + + check-js-files-inside-resources + generate-resources + + execute + + + + def dirPath = "${project.basedir}/src/main/resources" // Replace with your directory path + def dirExists = new File(dirPath).isDirectory() + + if (dirExists) + { + def jsFilesExist = checkForJsFiles(new File(dirPath)) + + if (jsFilesExist) { + // Execute the minify step here or set a property to control it. + // For example, you can set a property to true to indicate that minification is required. + project.properties['minifyRequiredInResources'] = 'false' + println "JavaScript files found. Minification is required." + } else { + project.properties['minifyRequiredInResources'] = 'true' + println "No JavaScript files found. Skipping minification." + } + + } + else{ + project.properties['minifyRequiredInResources'] = 'true' + } + + def checkForJsFiles(File directory) { + def jsFilesExist = false + directory.eachFileRecurse { file -> + if (file.name.endsWith('.js') && !matchesExclusionPatterns(file.path)) { + jsFilesExist = true + } + } + jsFilesExist + } + + def matchesExclusionPatterns(filePath) { + def exclusionPatterns = [ + 'webscripts', + 'META-INF', + '.*/.lib/.js', + '.*/.css', + '.*/.min/js', + '.*/.min/.css' + ] + return exclusionPatterns.any { pattern -> filePath =~ /.*\/$pattern\/.*/ } + } + + + + + + + - net.alchim31.maven - yuicompressor-maven-plugin - 1.5.1 + com.github.blutorange + closure-compiler-maven-plugin + 2.27.0 compress-assembly + generate-resources - compress + minify - ${project.basedir}/src/main/assembly/web - ${project.basedir}/src/main/assembly/web + ${project.basedir}/src/main/assembly + ${project.basedir}/src/main/assembly + web + web + true + ${minifyRequiredInAssembly} + + **/*.js + **/webscripts/** **/site-webscripts/** **/META-INF/** **/*.lib.js **/*.css - **/*-min.js - **/*-min.css + **/*.min.js + **/*.min.css true - false compress-resources + generate-resources - compress + minify + ${project.basedir}/src/main + ${project.basedir}/src/main + resources + resources + true + ${minifyRequiredInResources} + + **/*.js + **/webscripts/** **/site-webscripts/** **/*.lib.js **/*.css - **/*-min.js - **/*-min.css + **/*.min.js + **/*.min.css true - false + org.apache.maven.plugins maven-dependency-plugin