It's activated automatically by m2e. 2011/10/14 Gustavo Henrique Orair <[email protected]>
> Yes, you got it! > > Just another question (i do not understand maven profiles too much), > in your proposed solution, you've used the m2e.version property to activate > the m2e profile. > Is this property activated automatically when I have m2e installed in > Eclipse or I have to configure something inside Eclipse to define this > property? > > Br, > > Orair. > > > 2011/10/14 Fred Bricon <[email protected]> > >> If you use Eclipse to deploy your project to a maven repo, using the Maven >> > Build... menu, you should be able to disable the m2e profile by adding >> !m2e in the profile input text, that way the maven build launched within >> eclipse will use the exact same configuration as a plain CLI invocation. >> >> (I hope I understood your use case) >> >> >> 2011/10/14 Gustavo Henrique Orair <[email protected]> >> >>> Fred Bricon, >>> Thanks for your prompt response! >>> >>> I think that in your proposed approach resides a problem. If we use these >>> approach, we cannot deploy (maven-deploy) the package inside Eclipse >>> anymore. >>> This is a problem for us because we do not use CI software (such as >>> Hudson), so our developers deploy these artifacts manually to maven >>> repository (and presently we allow them to use Eclipse to do that). >>> If they do that, they will not understand why the deployed application >>> will not work when we package this WAR deployed inside an EAR project. >>> >>> I don't think files inside >>> ${project.build.directory}/m2e-wtp/web-resources would be packaged inside >>> the generated .war file? >>> Am I right? >>> >>> Regards, >>> Orair. >>> >>> >>> 2011/10/14 Fred Bricon <[email protected]> >>> >>>> Instead of having 2 execution-ids of the same plugin, I would use only >>>> one and define an yuiCompressorOutput property, having the default value of >>>> ${project.build.directory}/${project.build.finalName} and the value used >>>> within m2e would be ${project.build.directory}/m2e-wtp/web-resources/ >>>> >>>> That'd look like >>>> >>>> ... >>>> [in yuicompressor-maven-plugin config] >>>> <output>${yuiCompressorOutput}/resources/js/0_1_2/script-min.js</output> >>>> ... >>>> >>>> ... >>>> <properties> >>>> >>>> <yuiCompressorOutput>${project.build.directory}/${project.build.finalName}</yuiCompressorOutput> >>>> </properties> >>>> ... >>>> <profiles> >>>> <profile> >>>> <id>m2e</id> >>>> <activation> >>>> <property> >>>> <name>m2e.version</name> >>>> </property> >>>> </activation> >>>> <properties> >>>> >>>> <yuiCompressorOutput>${project.build.directory}/m2e-wtp/web-resources/ >>>> </yuiCompressorOutput> >>>> </properties> >>>> </profile> >>>> </profiles> >>>> >>>> Regards, >>>> >>>> Fred Bricon >>>> >>>> 2011/10/14 Gustavo Henrique Orair <[email protected]> >>>> >>>>> Recently, >>>>> we've decided to migrate to Eclipse Indigo and uses m2e 1.0. >>>>> But, we have problems trying to tackle the lifecycle mapping problem. >>>>> As I understood, we have to define in pom.xml lifecycle mapping >>>>> metadata to instruct Eclipse which executions should be executed when >>>>> sources are changed. >>>>> >>>>> In our WAR project, we want to write many small javascript source files >>>>> and these files would be merged in an unique file (minified or not). For >>>>> this task, we've planned to use yuicompressor-maven-plugin. >>>>> I didn't find too many docs instructing how to develop a connector for >>>>> this plugin. Just found an example inside m2e-core sources defining a >>>>> lyfecicle mapping metadata to instruct m2e to ignore the execution of this >>>>> plugin. >>>>> However, we would want to use and reference the merged file while >>>>> deploying the artifact using Eclipse WTP. >>>>> >>>>> The solution (I found googling) looks like to be instruct the plugin to >>>>> generate the merged javascript file inside m2e-wtp/web-resources/ >>>>> directory. >>>>> So, we have to define two executions for this plugin. One to generate >>>>> the merged file inside target (to be packaged) by maven >>>>> (yuicompressor-default execution id) another to generate the merged file >>>>> inside m2e-wtp/web-resources/ directory(yuicompressor- >>>>> eclipse execution id). >>>>> The second step would be to create the lifecycle metadata to instruct >>>>> the execution of the plugin that generates the merged file inside >>>>> m2e-wtp/web-resources. >>>>> One problem in this approach is that for each source file changed, both >>>>> yuicompressor-maven-plugin are executed since we didn't find a way to >>>>> ignore >>>>> just the yuicompressor-default execution. >>>>> >>>>> Here I present my pom.xml relevant sections: >>>>> Metadata filecycle mapping: >>>>> >>>>> <pluginManagement> >>>>> <plugins> >>>>> <!--This plugin's configuration is used to store >>>>> Eclipse m2e settings only. It has no influence on the Maven build >>>>> itself.--> >>>>> <plugin> >>>>> <groupId>org.eclipse.m2e</groupId> >>>>> <artifactId>lifecycle-mapping</artifactId> >>>>> <version>1.0.0</version> >>>>> <configuration> >>>>> <lifecycleMappingMetadata> >>>>> <pluginExecutions> >>>>> <pluginExecution> >>>>> <pluginExecutionFilter> >>>>> >>>>> <groupId>net.alchim31.maven</groupId> >>>>> >>>>> <artifactId>yuicompressor-maven-plugin</artifactId> >>>>> >>>>> <versionRange>[1.2,)</versionRange> >>>>> <id>yuicompressor-eclipse</id> >>>>> <goals> >>>>> <goal>compress</goal> >>>>> </goals> >>>>> </pluginExecutionFilter> >>>>> <action> >>>>> <execute></execute> >>>>> </action> >>>>> </pluginExecution> >>>>> </pluginExecutions> >>>>> </lifecycleMappingMetadata> >>>>> </configuration> >>>>> </plugin> >>>>> </plugins> >>>>> </pluginManagement> >>>>> >>>>> >>>>> >>>>> >>>>> Yui Compreessor maven Plugin configuration >>>>> >>>>> <plugins> >>>>> <plugin> >>>>> <groupId>net.alchim31.maven</groupId> >>>>> <artifactId>yuicompressor-maven-plugin</artifactId> >>>>> <version>1.2</version> >>>>> <executions> >>>>> <execution> >>>>> <id>yuicompressor-default</id> >>>>> <phase>process-resources</phase> >>>>> <goals> >>>>> <goal>compress</goal> >>>>> </goals> >>>>> <inherited>false</inherited> >>>>> <configuration> >>>>> <aggregations> >>>>> <aggregation> >>>>> <!-- remove files after aggregation >>>>> (default: false) <removeIncluded>true</removeIncluded> --> >>>>> <!-- insert new line after each >>>>> concatenation (default: false) --> >>>>> <insertNewLine>true</insertNewLine> >>>>> >>>>> <output>${project.build.directory}/${project.build.finalName}/resources/js/0_1_2/script.js</output> >>>>> <!-- base directory for non >>>>> absolute includes, default to parent dir of output --> >>>>> >>>>> <inputDir>${basedir}/src/main/webapp/resources/js/0_1_2</inputDir> >>>>> <!-- files to include, path >>>>> relative to output's directory or absolute path --> >>>>> <includes> >>>>> <include>file1.js</include> >>>>> <include>file2.js</include> >>>>> <include>file3.js</include> >>>>> <include>file4.js</include> >>>>> <include>file5.js</include> >>>>> <include>file6.js</include> >>>>> <include>file7.js</include> >>>>> </includes> >>>>> <!-- files to exclude, path >>>>> relative to output's directory <excludes> <exclude>**/*.pack.js</exclude> >>>>> <exclude>**/compressed.css</exclude> >>>>> </excludes> --> >>>>> </aggregation> >>>>> <aggregation> >>>>> <!-- remove files after aggregation >>>>> (default: false) <removeIncluded>true</removeIncluded> --> >>>>> <!-- insert new line after each >>>>> concatenation (default: false) --> >>>>> <insertNewLine>true</insertNewLine> >>>>> >>>>> <output>${project.build.directory}/${project.build.finalName}/resources/js/0_1_2/script-min.js</output> >>>>> <!-- base directory for non >>>>> absolute includes, default to parent dir of output --> >>>>> >>>>> <inputDir>${project.build.directory}/${project.build.finalName}/resources/js/0_1_2</inputDir> >>>>> <!-- files to include, path >>>>> relative to output's directory or absolute path --> >>>>> <includes> >>>>> <include>file1-min.js</include> >>>>> <include>file2-min.js</include> >>>>> <include>file3-min.js</include> >>>>> <include>file4-min.js</include> >>>>> <include>file5-min.js</include> >>>>> <include>file6-min.js</include> >>>>> <include>file7-min.js</include> >>>>> </includes> >>>>> <!-- files to exclude, path >>>>> relative to output's directory <excludes> <exclude>**/*.pack.js</exclude> >>>>> <exclude>**/compressed.css</exclude> >>>>> </excludes> --> >>>>> </aggregation> >>>>> </aggregations> >>>>> </configuration> >>>>> </execution> >>>>> <execution> >>>>> <id>yuicompressor-eclipse</id> >>>>> <phase>process-resources</phase> >>>>> <goals> >>>>> <goal>compress</goal> >>>>> </goals> >>>>> <inherited>false</inherited> >>>>> <configuration> >>>>> <aggregations> >>>>> <aggregation> >>>>> <!-- remove files after aggregation >>>>> (default: false) <removeIncluded>true</removeIncluded> --> >>>>> <!-- insert new line after each >>>>> concatenation (default: false) --> >>>>> <insertNewLine>true</insertNewLine> >>>>> >>>>> <output>${project.build.directory}/m2e-wtp/web-resources/resources/js/0_1_2/script.js</output> >>>>> >>>>> <!-- base directory for non >>>>> absolute includes, default to parent dir of output --> >>>>> >>>>> <inputDir>${basedir}/src/main/webapp/resources/js/0_1_2</inputDir> >>>>> <!-- files to include, path >>>>> relative to output's directory or absolute path --> >>>>> <includes> >>>>> <include>file1-min.js</include> >>>>> <include>file2-min.js</include> >>>>> <include>file3-min.js</include> >>>>> <include>file4-min.js</include> >>>>> <include>file5-min.js</include> >>>>> <include>file6-min.js</include> >>>>> <include>file7-min.js</include> >>>>> </includes> >>>>> <!-- files to exclude, path >>>>> relative to output's directory <excludes> <exclude>**/*.pack.js</exclude> >>>>> <exclude>**/compressed.css</exclude> >>>>> </excludes> --> >>>>> </aggregation> >>>>> <aggregation> >>>>> <!-- remove files after aggregation >>>>> (default: false) <removeIncluded>true</removeIncluded> --> >>>>> <!-- insert new line after each >>>>> concatenation (default: false) --> >>>>> <insertNewLine>true</insertNewLine> >>>>> >>>>> <output>${project.build.directory}/m2e-wtp/web-resources/resources/js/0_1_2/script-min.js</output> >>>>> <!-- base directory for non >>>>> absolute includes, default to parent dir of output --> >>>>> >>>>> <inputDir>${project.build.directory}/${project.build.finalName}/resources/js/0_1_2</inputDir> >>>>> <!-- files to include, path >>>>> relative to output's directory or absolute path --> >>>>> <includes> >>>>> <include>file1-min.js</include> >>>>> <include>file2-min.js</include> >>>>> <include>file3-min.js</include> >>>>> <include>file4-min.js</include> >>>>> <include>file5-min.js</include> >>>>> <include>file6-min.js</include> >>>>> <include>file7-min.js</include> >>>>> </includes> >>>>> <!-- files to exclude, path >>>>> relative to output's directory <excludes> <exclude>**/*.pack.js</exclude> >>>>> <exclude>**/compressed.css</exclude> >>>>> </excludes> --> >>>>> </aggregation> >>>>> </aggregations> >>>>> </configuration> >>>>> </execution> >>>>> </executions> >>>>> <configuration> >>>>> <!-- >>>>> <disableOptimizations>false</disableOptimizations> --> >>>>> >>>>> <!-- <encoding></encoding> --> >>>>> <!-- <failOnWarning>true</failOnWarning> --> >>>>> <!-- Zip the files. Defaults to false --> >>>>> <!-- <gzip>true</gzip> --> >>>>> <!-- force the compression of every files, else if >>>>> compressed file already exists and is younger than source file, nothing is >>>>> done. --> >>>>> <!-- <force>true</force> --> >>>>> <!-- Unable JavaScript warnings --> >>>>> <jswarn>false</jswarn> >>>>> </configuration> >>>>> </plugin> >>>>> </plugins> >>>>> >>>>> >>>>> Is there another better way to integrate merging and minifying >>>>> javascript or css files inside m2e lifecycle deploying phase? >>>>> >>>>> >>>>> Best regards, >>>>> Orair. >>>>> >>>>> _______________________________________________ >>>>> m2e-users mailing list >>>>> [email protected] >>>>> https://dev.eclipse.org/mailman/listinfo/m2e-users >>>>> >>>>> >>>> >>>> >>>> -- >>>> "Have you tried turning it off and on again" - The IT Crowd >>>> >>>> _______________________________________________ >>>> m2e-users mailing list >>>> [email protected] >>>> https://dev.eclipse.org/mailman/listinfo/m2e-users >>>> >>>> >>> >>> _______________________________________________ >>> m2e-users mailing list >>> [email protected] >>> https://dev.eclipse.org/mailman/listinfo/m2e-users >>> >>> >> >> >> -- >> "Have you tried turning it off and on again" - The IT Crowd >> >> _______________________________________________ >> m2e-users mailing list >> [email protected] >> https://dev.eclipse.org/mailman/listinfo/m2e-users >> >> > > _______________________________________________ > m2e-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/m2e-users > > -- "Have you tried turning it off and on again" - The IT Crowd
_______________________________________________ m2e-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/m2e-users
