Maven Plugin Execution Order and excluding js files - maven-2

I have developed the pom.xml to first combine all the js files in the project and then compress the JS file. These 2 steps are two plugin and are in compile phase.
But some how few times puglin execution order is reversed and build fails. In case some one has seen this issue please redirect me to solution.
Secondly, I don't to include the JS in .war which are combined and compressed.

To strictly answer the first part of the question, plugins bound to the same phase are supposed to be executed in the same order as they are listed in the POM and any other behavior should be considered as a but (see MNG-2258). But I personally get the expected behavior with Maven 2.2.1.
Answering the second part of the question will be harder without more details:
what is the structure of your project?
where are the initial files located?
what are you using or doing (are you using the YIU Compressor of the previous question?)?
if yes, do you know that it can deal with aggregations (and thus remove the need for two executions)
where do you output compressed file?
In other words, give more info please.

Related

Is it possible to configure IntelliJ to not index specific files?

Scripts and styles for the project I'm working on get compiled and minified into single (enormous) files when the project is built. When IntelliJ goes to index everything, it spends a significant amount of time indexing the minified files, which are all but useless for the purpose of searching.
Is there a way to ignore specifically these files, and not just a directory?
I'm taking mostly a guess here, IntelliJ docs are notorious for being not-so-helpful on some topics.
Try marking the files as plain text:
When a file is marked as plain text, IntelliJ IDEA does not use it anymore for code completion and navigation...The reverse action is also available: you can return a file to its original type, using the Mark as action
Edit: After hearing that your files are dynamically created, I think I may have figured out a solution.
IntelliJ allows for the creation of Scopes, which allow you to exclude certain files from the project. You can then go to Editor -> Inspections and change the scope of each inspection from All Scopes to your new scope

C#, Gendarme, Sonar and Jenkins : Exclude generated files from Gendarme

I'm working with gendarme for .net called by Sonar (launched by Jenkins).
I've a lot of AvoidVisibleFieldsRule violations. The main violations are found in the generated files. As I can't do anything on it, i would like to exclude *.designer.cs from the scan.
I can't find a way to do that. There is a properties in Sonar to exclude generated files but it doesn't seem to be applied for gendarme.
Is there a way to do such a thing ?
Thanks for all
Gendarme expects you provide an ignore list,
http://www.mono-project.com/Gendarme.FAQ
https://github.com/mono/mono-tools/blob/master/gendarme/self-test.ignore
The ignore file format is bit of weird, but you can learn it by experiments.
Indeed that is actually not normal at all. Generated code is excluded by the plugin with the standard configuration. What version of the C# plugins are you using ?
Anyway, the configuration property you can try is "sonar.exclusions" (see http://docs.codehaus.org/display/SONAR/Advanced+parameters).
If you do not solve your problem right away, the best thing would be to drop a mail to the user mailing list (see http://www.sonarsource.org/support/support/) and send the verbose output of your build. To get this output simply add "-X" to the command line.
Hope it helps

Flash Builder: conditional compilation - app.xml

I have a flash project that shall target different platforms. However - code is not completely the same for the different platforms.
using compiler statements and config blocks like
CONFIG::MOBILE{
...mobile specific code here...
}
I can easily maintain the different versions within the same project.
However - there should also be different mainapp-app.xml files be used for the different versions - or depending on the compiler flags different content within the mainapp-app.xml
how can I do that?
Great question. Indeed, you can create multiple config.xml files in your project and link to these config files via compiler arguments. I generally use ANT to do this as it makes the build process simple. But if you don't have ANT setup, simply right click on your project, select ActionScript Compiler and add the following to the list of additional compiler arguments:
-load-config+=config/mainapp-app.xml
Note that the config folder is relative to the project root. I generally put my config files in this folder. I wrote a detailed post on how to perform conditional compilation in AS3 on my blog. Visit http://www.willjohnson.me/blog/?p=146 for detailed instructions.
I hope this answered your question.
Regards,
Will

Maven build for different profiles

We're trying to migrate from current Ant build to Maven. In the current project, we've different properites files for each of the env say
qa.properties, prod.properties & dev.properties.
The property values present in these files, are used to replace wherever these properties are being referred through config files (present in src\main\resources\config ). The current Ant build process replaces all these properties which are being referred in config files with their corresponding value for the current build env.
I'm somewhat aware of the Profiles concept in maven. However, I'm not able to figure how to achieve this using maven.
Any help would be appreicated.
Thanks,
Prabhjot
There are several ways to implement this but they are all variations around the same features: combine profiles with filtering. A Maven2 multi-environment filter setup shows one way to implement such a setup (a little variation would be to move the filter declaration inside each profile).
See also
9.3. Resource Filtering

Customized generation/filtering resources with maven

I wonder what is the Maven way in my situation.
My application has a bunch of configuration files, let's call them profiles. Each profile configuration file is a *.properties file, that contains keys/values and some comments on these keys/values semantics. The idea is to generate these *.properties to have unified comments in all of them.
My plan is to create a template.properties file that contains something like
#Comments for key1/value1
key1=${key1.value}
#Comments for key2/value2
key2=${key2.value}
and a bunch of files like
#profile_data_1.properties
key1.value=profile_1_key_1_value
key2.value=profile_1_key_2_value
#profile_data_2.properties
key1.value=profile_2_key_1_value
key2.value=profile_2_key_2_value
Then bind to generate-resources phase to create a copy of template.properties per profile_data_, and filter that copy with profile_data_.properties as a filter.
The easiest way is probably to create an ant build file and use antrun plugin. But that is not a Maven way, is it?
Other option is to create a Maven plugin for that tiny task. Somehow, I don't like that idea (plugin deployment is not what I want very much).
Maven does offer filtering of resources that you can combine with Maven profiles (see for example this post) but I'm not sure this will help here. If I understand your needs correctly, you need to loop on a set of input files and to change the name of the output file. And while the first part would be maybe possible using several <execution>, I don't think the second part is doable with the resources plugin.
So if you want to do this in one build, the easiest way would be indeed to use the Maven AntRun plugin and to implement the loop and the processing logic with Ant tasks.
And unless you need to reuse this at several places, I wouldn't encapsulate this logic in a Maven plugin, this would give you much benefits if this is done in a single project, in a unique location.
You can extend the way maven does it's filtering, as maven retrieves it's filtering strategy from the plexus container via dependency injection. So you would have to register a new default strategy. This is heavy stuff and badly documented, but I think it can be done.
Use these URLs as starting point:
http://maven.apache.org/shared/maven-filtering/usage.html
and
http://maven.apache.org/plugins/maven-resources-plugin/
Sean