Projet

Général

Profil

MAY Maven Eclipse Setup » Historique » Version 3

Anonyme, 02/10/2014 10:58

1 1 Anonyme
h1. SpeADL MAY Maven Eclipse SetUp
2
3 3 Anonyme
h2. Install the Maven Eclipse Plugin
4 1 Anonyme
5 3 Anonyme
The Maven Eclipse Plugin, also named M2E, is available as part of the normal Eclipse distribution but must be explicitly installed.
6
7
Go to *Help* / *Install New Software...* and select the *All available site* in the drop-down list (it may take some time to load).
8
9
Expand the *Collaboration* category and select *m2e - Maven Integration for Eclipse*.
10
11
Click *Finish*.
12
13
h2. Convert an Existing Project to Maven
14
15 1 Anonyme
The first step is to convert your project into a Maven project.
16
To do this, right click on your project and on *Configure* / *Convert to Maven Project*.
17
18 3 Anonyme
You will be asked to create a new POM file. Just click *Finish* after editing the package, name and version.
19
20
Alternatively, you can directly create a Maven project, this is out of scope of this document.
21
22
h2. Edit the POM File
23
24
25 1 Anonyme
26
<pre>
27
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
28
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
29
	<modelVersion>4.0.0</modelVersion>
30
	<groupId>XXX</groupId>
31
	<artifactId>XXX</artifactId>
32
	<version>XXX</version>
33
	
34
	<properties>
35
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36
		<may-lib-version>3.3.0</may-lib-version>
37
	</properties>
38
39
	<dependencies>
40
		<dependency>
41
			<groupId>fr.irit.smac.lib.may</groupId>
42
			<artifactId>common-components</artifactId>
43
			<version>${may-lib-version}</version>
44
		</dependency>
45
	</dependencies>
46
47
	<repositories>
48
		<repository>
49
			<id>fr.irit.smac</id>
50
			<url>http://www.irit.fr/~Victor.Noel/maven-repos/</url>
51
		</repository>
52
	</repositories>
53
54
	<build>
55
		<sourceDirectory>src</sourceDirectory>
56
		<plugins>
57
			<plugin>
58
				<artifactId>maven-compiler-plugin</artifactId>
59
				<configuration>
60
					<source>1.7</source>
61
					<target>1.7</target>
62
				</configuration>
63
			</plugin>
64
			<plugin>
65
				<groupId>org.codehaus.mojo</groupId>
66
				<artifactId>build-helper-maven-plugin</artifactId>
67
				<version>1.8</version>
68
				<executions>
69
					<execution>
70
						<id>add-source</id>
71
						<goals>
72
							<goal>add-source</goal>
73
						</goals>
74
						<configuration>
75
							<sources>
76
								<source>speadl-gen</source>
77
							</sources>
78
						</configuration>
79
					</execution>
80
					<!-- The following is only needed so that speadl files are included in the generated maven artifact -->
81
					<execution>
82
						<id>add-resource</id>
83
						<goals>
84
							<goal>add-resource</goal>
85
						</goals>
86
						<configuration>
87
							<resources>
88
								<resource>
89
									<directory>${project.build.sourceDirectory}</directory>
90
									<includes>
91
										<include>**/*.speadl</include>
92
									</includes>
93
								</resource>
94
							</resources>
95
						</configuration>
96
					</execution>
97
				</executions>
98
			</plugin>
99
		</plugins>
100
	</build>
101
</project>
102
</pre>
103 2 Anonyme
104
h2. Possible issues and resolutions
105
106
You may get an error message saying your project configuration is out of date with your new pom.xml.
107
108
Update it : right click on your project *Maven* / *Update Project Configuration...* and click *Ok*.
109
110
!https://wwwsecu.irit.fr/redmine/attachments/download/337/update_project_conf.jpg!