Projet

Général

Profil

MAY Project Setup » Historique » Version 18

Anonyme, 09/11/2011 14:29

1 1 Anonyme
*Draft version...*
2
3
h1. SpeADL MAY Project SetUp
4
5 18 Anonyme
h2. A classic JAVA project to start with...
6
7 1 Anonyme
First, create a java project, choose a name, and click finish. Add the SpeADL Nature to the project : right click on the project / Configure / Add SpeADL Nature.
8
_This is necessary in order to..._
9
10 4 Anonyme
Then, create a new file with the speadl extension within the src folder. Eclipse will ask you if you want to add Xtext nature to the project, click yes.
11 3 Anonyme
12 2 Anonyme
!https://wwwsecu.irit.fr/redmine/attachments/download/336/add_xtext_nature_confirm.jpg!
13 5 Anonyme
14
The next step is to convert your project into a Maven project. To do this, right click on your project / Configure / Convert to Maven Project.
15
You will be asked to create a new POM file. Just click finish and edit it manually. A good starting pom.xml for a new project is the following:
16
17 6 Anonyme
<pre>
18
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20
	<modelVersion>4.0.0</modelVersion>
21
	<groupId>XXX</groupId>
22
	<artifactId>XXX</artifactId>
23
	<version>0.0.1-SNAPSHOT</version>
24
	<dependencies>
25
		<dependency>
26
			<groupId>fr.irit.smac.may.lib</groupId>
27
			<artifactId>common-components</artifactId>
28
			<version>0.0.3-SNAPSHOT</version>
29
			<type>jar</type>
30
			<scope>compile</scope>
31
		</dependency>
32
	</dependencies>
33
	<repositories>
34
		<repository>
35
			<id>fr.irit.smac</id>
36
			<url>http://www.irit.fr/~Victor.Noel/maven-repos/</url>
37
		</repository>
38
	</repositories>
39
	<build>
40
		<plugins>
41
			<plugin>
42
				<groupId>org.codehaus.mojo</groupId>
43
				<artifactId>build-helper-maven-plugin</artifactId>
44
				<version>1.7</version>
45
				<executions>
46
					<execution>
47
						<id>add-source</id>
48
						<phase>generate-sources</phase>
49
						<goals>
50
							<goal>add-source</goal>
51
						</goals>
52
						<configuration>
53
							<sources>
54
								<source>src-gen</source>
55
							</sources>
56
						</configuration>
57
					</execution>
58
				</executions>
59
			</plugin>
60
		</plugins>
61
	</build>
62
</project>
63
</pre>
64 5 Anonyme
65 8 Anonyme
h1. Possible issues and resolutions
66
67 10 Anonyme
h2. Project configuration is not up-to-date
68
69 5 Anonyme
You may get an error message saying your project configuration is out of date with your new pom.xml
70
Update it : right click on your project / Maven / Update Project Configuration...
71 7 Anonyme
72 1 Anonyme
!https://wwwsecu.irit.fr/redmine/attachments/download/337/update_project_conf.jpg!
73 12 Anonyme
74
h2. Proxy and Maven
75 8 Anonyme
76 13 Anonyme
In case you are behind a proxy, Maven may not be able to resolve dependencies. You have to configure Maven.
77 9 Anonyme
Window / Preferences / Maven / User Settings
78
79
!https://wwwsecu.irit.fr/redmine/attachments/download/338/maven_settings_proxy.jpg!
80
81 15 Anonyme
The settings.xml file located in the indicated directory usually doesn't even exit. Go to this directory and create an empty settings.xml file.
82 9 Anonyme
Edit it like this:
83
84
<pre>
85
<settings>
86
  <proxies>
87
   <proxy>
88
      <active>true</active>
89
      <protocol>http</protocol>
90
      <host>XXX</host>
91
      <port>YYY</port>
92
    </proxy>
93
  </proxies>
94
</settings>
95
</pre>
96
97
Replace XXX by your proxy URL and YYY by the port used. Ask your administrator if you don't know it.
98 17 Anonyme
When it's done, click Browse and select your settings.xml file, then click Update Settings.
99
This may take some take before the errors disapear, Maven is resolving dependencies and updating the project.