80 likes | 254 Views
MAVEN. Abhishek Dey Das | Sudhanshu Iyer. abhis.ws. |. siyer.info. An example…. The logger used in the Acme Project has been updated. The logger now supports severity levels. It is required that the programs you wrote use this updated dependency.
E N D
MAVEN AbhishekDey Das | Sudhanshu Iyer abhis.ws | siyer.info
An example… • The logger used in the Acme Project has been updated. • The logger now supports severity levels. • It is required that the programs you wrote use this updated dependency. How will you accommodate for this ? Try to think if your program had not one but 100 dependencies (such a scenario is very common)
pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>ws.abhis.utdwrkshp</groupId> <artifactId>rudimentary-logger</artifactId> <packaging>jar</packaging> <version>4.0-SNAPSHOT</version> <name>rudimentary-logger</name> <url>http://abhis.ws:8080/nexus</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build>
pom.xml <distributionManagement> <repository> <id>abhisws-repository</id> <name>Abhisws Repository</name> <url>http://abhis.ws:8080/nexus/content/repositories/utd_workshop/</url> </repository> </distributionManagement> </project>
Setting up Eclipse with Maven & Creating a new project using Maven • Modify settings.xml to use the workshop Maven repositorysettings.xml can be found at home/utd/.m2 • Install the maven eclipse plugin • Create a new project using: mvnarchetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false • Import the project into eclipse • Tell eclipse that it’s a maven project mvneclipse:eclipse
Project 5 • Use the updated logger in Acme Corp. ProjectThe updated logger can be found at: http://abhis.ws:8080/nexus • Use version 4.0-Snapshot
Helpful List of Commands • mvn clean – Cleans the workspace • mvn test – Runs JUnit Tests • mvn compile – Complies the Project • mvn compile-test – Runs tests and based on results complies the Project • mvn deploy – Deploy artifacts to the maven repository
That’s it! Questions ? Thank You