Reputation: 689
when I create a maven project in intellj, and because of network intellj cannot get "archetype-catalog.xml" from "maven.apache.org". So I dowload it to ".m2\repository\org\apache\maven\archetype\archetype-catalog\2.4" manually without choice and in the other hand I try to change the vm options like below:
The question is every time I create a new project this setting just gone. So do I just have to add the "-DarchetypeCatalog=local" every time? As you can see this is the 14th demo, how can I solve this problem? By the way If I use command line to generate new project it will generate a whole nice project with a /resources directory.
Upvotes: 1
Views: 674
Reputation: 18869
To setup that property as the default so that it gets picked up by all new projects :
File -> Other Settings -> Default Settings
And then do the same thing (i.e. Build Tools -> Maven -> Runner). After this any projects created from this point on, will inherit that JVM arg.
The remaining options below are IDE agnostic.
The following options are based on http://maven.apache.org/configure.html
How about setting the following environment variable ?
MAVEN_OPTS = "-DarchetypeCatalog=local"
The other would be to edit mvn.bat
or mvn.sh
directly to add that property in.
mavenrc
fileI noticed the following in v. 3.3.9 of the maven shell script:
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
So you could put that property in either /etc/mavenrc
or in ~/.mavenrc
and make sure that MAVEN_SKIP_RC
is not set.
Upvotes: 1