I'm using intellij 14 and have the maven projects window open.
Why are there 2 different kinds of checkboxes? If you select the checkbox once, it will leave a white check. If you select it again, it will change the checkbox to gray. Whats the difference?
I also want to know how to tell a specific module (not the entire project) to use a particular maven profile that is only available to that module.
I have been unable to find this information on intellij's site.
Thanks!
There are three possible states for a profile:
Disabled:
Active:
Active by Default:
The last one is activated by setting something like this in your pom.xml
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
Related
How can I increase the number of http(s) connections a maven build will use to download and upload Artifacts from the repository (Artifactory or similar).
I have seen this page:
https://maven.apache.org/guides/mini/guide-http-settings.html
But it does not say what is the parameter and syntax to set it.
I am using Apache Maven 3.6.0
according to Maven documentation By default, Maven 2.1.0+ will download up to 5 artifacts (from different groups) at once. To change the size of the thread pool, start Maven using following switch option to change default value:
-Dmaven.artifact.threads
for example :
mvn -Dmaven.artifact.threads=1 verify
You may wish to set this option permanently, in which case you can use the MAVEN_OPTS environment variable. For example:
export MAVEN_OPTS=-Dmaven.artifact.threads=3
There is options for maven:
maven.artifact.threads for configuring parallel artifacst resolution
You can use it as is described on site:
https://maven.apache.org/guides/mini/guide-configuring-maven.html
You can also add this properties to your settings.xml so will be affected for all builds:
<settings>
<profiles>
<profile>
<id>props</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<maven.artifact.threads>10</maven.artifact.threads>
</properties>
</profile>
</profiles>
</settings>
I have searched for a way to change this (unwanted) behavior.
I set command line arguments in Project->Properties->Run->Parameters and run my program in NetBeans IDE. Arguments gets passed to my program just fine, but they also turn up when I run the .jar from a .bat-file or .sh-script after it is compiled.
So my customer ends up having my test arguments activated if I forget to remove the settings from project settings before distributing my .jar.
I would have expected this info to be removed from the .jar. At least after compiling without debug information.
Is there a way to remove the arguments from my distribution without removing them from my project settings?
Anyone else having the same problem?
You could add a configuration (Project->Properties->Configurations->Add), select the created configuration under "Project->Properties->Run" and specify the arguments only for this configuration.
But this way is NetBeans specific. If you are using Maven you should use profiles. Add something like this into your pom.xml:
<project>
...
<profiles>
<profile>
<id>test</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!--your command line arguments-->
<exec.args>hello world</exec.args>
</properties>
</profile>
</profiles>
...
</project>
You still would need to remember to deactivate your development profile before shipping but like this you can separate the configuration between development and production system in a clean way. (Especially if later on there should be other configuration values which should differ, like logging level, different paths and so on).
I would like to know if using IntelliJ, is possible to run all test in the visual environment choosing a specific Junit category.
At the moment if you execute:
mvn clean test
you execute Fast Tests, but how to use IntelliJ to choose Slow or Fast?
Fragment of pom.xml
<profiles>
<profile>
<id>SlowTest</id>
<properties>
<testcase.groups>YOUR.PROJECT.test.categories.Slow</testcase.groups>
</properties>
</profile>
<profile>
<id>FastTest</id>
<properties>
<testcase.groups>YOUR.PROJECT.test.categories.Fast</testcase.groups>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
Many thanks in Advance
Juan Antonio
Your profiles are focusing the test run on specific categories. The JUnit Run/Debug configuration in IntelliJ also allows you to focus a JUnit run on a specific category.
You can access this configuration window from Run > Edit Configurations
Here's a screenshot showing a saved confoguiraiton named SlowTests which runs all tests having the category: com.stackoverflow.surefire.SlowTests:
You can save any such configuration by clicking on the file icon in the top left hand corner of this window and then that configuration will be available in the Run menu and you can even associate a keyboard short cut with it.
More information in the docs.
If you created your project using the pom.xml, in the "Maven Projects"-View you can activate the profiles you want to be active. There (Lifecycle) you can start the goal you want to be executed for each module as well.
How to get this: View->Tool Windows->Maven Projects
I have a Maven profile documentation that I want to get activated when running mvn jgitflow:release-finish. I know that I can do:
mvn jgitflow:release-finish -Pdocumentation
because the documentation of the plugin states:
automatically copies any profiles (-P) and user-properties (-D) passed on the command line to the forked maven process when building
But that means that you cannot forget to add this profile manually.
Objective: I would like to be able to configure Maven so that this profile becomes active automatically (Or that I somehow can activate my profile when the 'release' profile is active).
The jgitflow:release-finish goal actually uses a default option useReleaseProfile defining:
Whether to use the release profile that adds sources and javadocs to the released artifact, if appropriate. If set to true, the plugin sets the property performRelease to true, which activates the profile "release-profile", which is inherited from the super pom.
This option has default value to true, hence when executing this goal will by default set the performRelease property to true.
Note that the release profile mentioned above is defined by the super POM, which is actually used by this plugin but also by the maven-release-plugin via the similar useReleaseProfile option.
You can then activate your profile based on this option as well, as following:
<profiles>
<profile>
<id>documentation</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
...
</profile>
</profiles>
This means that you can still esplicitely activate it via the -P option and that it will be automatically activated by the goal as well.
Currently I have a Maven project in Eclipse Luna.
I defined a profile in the pom.xml:
<profile>
<id>prof</id>
<properties>
<deploy.local.backupDir>/cygdrive/c/Users/Ferrarim/Sandbox/FSD/backup</deploy.local.backupDir>
<deploy.local.warDir>/cygdrive/c/Users/Ferrarim/Workspaces/eclipse-luna-fsd/fsd-backend/target</deploy.local.warDir>
</properties>
</profile>
I can find it under (right click on the project in Eclipse): Maven->Select Active profiles.
I can also create a Maven Run Configuration and put "prof" in the profiles option of the Run Configuration, but it's ignored during the build.
Can someone please explain the difference between the two approaches?
I would like to the second approach (select profiles via Run Configuration)
The solution was to disable "Build Automatically" under Project menu in Eclipse. Obvious after thinking about it...
Edit (to clarify): "Select Maven profiles" is used to choose which profiles are needed during the automatic Eclipse build.