Projet

Général

Profil

MAY Maven Eclipse Setup » Historique » Révision 3

Révision 2 (Anonyme, 01/10/2014 16:10) → Révision 3/15 (Anonyme, 02/10/2014 10:58)

h1. SpeADL MAY Maven Eclipse SetUp 

 h2. Install the Maven Eclipse Plugin 

 


 The Maven Eclipse Plugin, also named M2E, is available as part of the normal Eclipse distribution but must be explicitly installed. 

 Go to *Help* / *Install New Software...* and select the *All available site* in the drop-down list (it may take some time to load). 

 Expand the *Collaboration* category and select *m2e - Maven Integration for Eclipse*. 

 Click *Finish*. 

 h2. Convert an Existing Project to Maven 

 The first step is to convert your project into a Maven project. 
 To do this, right click on your project and on *Configure* / *Convert to Maven Project*. 

 You will be asked to create a new POM file. Just click *Finish* after editing and edit it as in the package, name and version. following: 

 Alternatively, you can directly create a Maven project, this is out of scope of this document. 

 h2. Edit the POM File 



 <pre> 
 <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/xsd/maven-4.0.0.xsd"> 
	 <modelVersion>4.0.0</modelVersion> 
	 <groupId>XXX</groupId> 
	 <artifactId>XXX</artifactId> 
	 <version>XXX</version> 
	
	 <properties> 
		 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
		 <may-lib-version>3.3.0</may-lib-version> 
	 </properties> 

	 <dependencies> 
		 <dependency> 
			 <groupId>fr.irit.smac.lib.may</groupId> 
			 <artifactId>common-components</artifactId> 
			 <version>${may-lib-version}</version> 
		 </dependency> 
	 </dependencies> 

	 <repositories> 
		 <repository> 
			 <id>fr.irit.smac</id> 
			 <url>http://www.irit.fr/~Victor.Noel/maven-repos/</url> 
		 </repository> 
	 </repositories> 

	 <build> 
		 <sourceDirectory>src</sourceDirectory> 
		 <plugins> 
			 <plugin> 
				 <artifactId>maven-compiler-plugin</artifactId> 
				 <configuration> 
					 <source>1.7</source> 
					 <target>1.7</target> 
				 </configuration> 
			 </plugin> 
			 <plugin> 
				 <groupId>org.codehaus.mojo</groupId> 
				 <artifactId>build-helper-maven-plugin</artifactId> 
				 <version>1.8</version> 
				 <executions> 
					 <execution> 
						 <id>add-source</id> 
						 <goals> 
							 <goal>add-source</goal> 
						 </goals> 
						 <configuration> 
							 <sources> 
								 <source>speadl-gen</source> 
							 </sources> 
						 </configuration> 
					 </execution> 
					 <!-- The following is only needed so that speadl files are included in the generated maven artifact --> 
					 <execution> 
						 <id>add-resource</id> 
						 <goals> 
							 <goal>add-resource</goal> 
						 </goals> 
						 <configuration> 
							 <resources> 
								 <resource> 
									 <directory>${project.build.sourceDirectory}</directory> 
									 <includes> 
										 <include>**/*.speadl</include> 
									 </includes> 
								 </resource> 
							 </resources> 
						 </configuration> 
					 </execution> 
				 </executions> 
			 </plugin> 
		 </plugins> 
	 </build> 
 </project> 
 </pre> 

 h2. Possible issues and resolutions 

 You may get an error message saying your project configuration is out of date with your new pom.xml. 

 Update it : right click on your project *Maven* / *Update Project Configuration...* and click *Ok*. 

 !https://wwwsecu.irit.fr/redmine/attachments/download/337/update_project_conf.jpg!