New project with maven (small help note)
Once in a while I need to make small java applications maybe for testing some library, maybe as helper applications. As for me the fastest way to do this, is use maven archetype mechanism. But new project creation command not very user friendly since it required several parameters that you need to remember (‘-DarchetypeGroupId’ or ‘-DgroupId’). As solution you can make small help script and put it into your projects folder.
As quick solution I make small shell script (new_project.sh) that can be used for fast start:
#!/bin/sh
PROJECTNAME=$1
if test $# -eq 0
then
echo "Please include project name as first parameter"
exit 1
fi
mvn archetype:create \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DgroupId=com.kobyleha.$PROJECTNAME \
-DartifactId=$PROJECTNAME
cd $PROJECTNAME
mvn install
mvn eclipse:eclipse
So now any time I need to have new project I just type:
./new_project.sh some_project_name
And then open already exists project in eclipse.
P.S. of course shell script can be much improved, as example it can be done as some wizard. Any way I think this small tip can help for someone in future.
»
- 1504 reads
- Russian