Example using sed:

sed
's/<dependencies>/<dependencies>\r\n\r\n<dependency>\r\n<groupId>org.ghost4j<\/groupId>\r\n<artifactId>ghost4j<\/artifactId>\r\n<version>0.5.0<\/version>\r\n<\/dependency>\r\n/g'
pom.xml > pom2.xml

Replaces the dependencies tag with the dependencies tag followed by the new
dependency (inserts the new dependency first in the list.

Creates a new file pom2.xml with the new dependency (this can be changed to
overwrite the original file using: pom.xml > pom.xml



--
View this message in context: 
http://maven.40175.n5.nabble.com/Programmatically-adding-dependencies-to-a-MavenProject-tp215077p5772864.html
Sent from the Maven Developers mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to