Projet

Général

Profil

MAY Project Setup » Historique » Version 26

Anonyme, 10/11/2011 14:37

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 19 Anonyme
h2. Maven convertion
15
16 5 Anonyme
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.
17
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:
18
19 6 Anonyme
<pre>
20
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22
	<modelVersion>4.0.0</modelVersion>
23
	<groupId>XXX</groupId>
24
	<artifactId>XXX</artifactId>
25
	<version>0.0.1-SNAPSHOT</version>
26
	<dependencies>
27
		<dependency>
28
			<groupId>fr.irit.smac.may.lib</groupId>
29
			<artifactId>common-components</artifactId>
30
			<version>0.0.3-SNAPSHOT</version>
31
			<type>jar</type>
32
			<scope>compile</scope>
33
		</dependency>
34
	</dependencies>
35
	<repositories>
36
		<repository>
37
			<id>fr.irit.smac</id>
38
			<url>http://www.irit.fr/~Victor.Noel/maven-repos/</url>
39
		</repository>
40
	</repositories>
41
	<build>
42
		<plugins>
43
			<plugin>
44
				<groupId>org.codehaus.mojo</groupId>
45
				<artifactId>build-helper-maven-plugin</artifactId>
46
				<version>1.7</version>
47
				<executions>
48
					<execution>
49
						<id>add-source</id>
50
						<phase>generate-sources</phase>
51
						<goals>
52
							<goal>add-source</goal>
53
						</goals>
54
						<configuration>
55
							<sources>
56
								<source>src-gen</source>
57
							</sources>
58
						</configuration>
59
					</execution>
60
				</executions>
61
			</plugin>
62
		</plugins>
63
	</build>
64
</project>
65
</pre>
66 5 Anonyme
67 8 Anonyme
h1. Possible issues and resolutions
68
69 23 Anonyme
h2. m2e connectors
70
71 24 Anonyme
Open your pom.xml file with the Maven POM Editor. In the overview tab, if you get this error:
72 23 Anonyme
73
!https://wwwsecu.irit.fr/redmine/attachments/download/344/me2_connectors.jpg!
74
75 25 Anonyme
Click "discover new m2e connectors", select buildhelper, then click finish.
76 23 Anonyme
Click Next to install m2e connector for build-helper-maven-plugin. Accept the terms of the licence agreements, and the security warning. Restart Eclipse.
77
78 10 Anonyme
h2. Project configuration is not up-to-date
79
80 5 Anonyme
You may get an error message saying your project configuration is out of date with your new pom.xml
81
Update it : right click on your project / Maven / Update Project Configuration...
82 7 Anonyme
83 1 Anonyme
!https://wwwsecu.irit.fr/redmine/attachments/download/337/update_project_conf.jpg!
84 12 Anonyme
85
h2. Proxy and Maven
86 8 Anonyme
87 20 Anonyme
In case you are behind a proxy, Maven may not be able to resolve dependencies.
88
You might get an error message like "failed to read arfifact descriptor" and "could not calculate build plan".
89 21 Anonyme
90
!https://wwwsecu.irit.fr/redmine/attachments/download/340/proxy_issue.jpg!
91
92 20 Anonyme
You have to configure Maven.
93 9 Anonyme
Window / Preferences / Maven / User Settings
94
95
!https://wwwsecu.irit.fr/redmine/attachments/download/338/maven_settings_proxy.jpg!
96
97 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.
98 9 Anonyme
Edit it like this:
99
100
<pre>
101
<settings>
102
  <proxies>
103
   <proxy>
104
      <active>true</active>
105
      <protocol>http</protocol>
106
      <host>XXX</host>
107
      <port>YYY</port>
108
    </proxy>
109
  </proxies>
110
</settings>
111
</pre>
112
113
Replace XXX by your proxy URL and YYY by the port used. Ask your administrator if you don't know it.
114 17 Anonyme
When it's done, click Browse and select your settings.xml file, then click Update Settings.
115
This may take some take before the errors disapear, Maven is resolving dependencies and updating the project.
116 26 Anonyme
You can track the progression by clicking on this button, located down in the eclipse interface.
117 22 Anonyme
118
!https://wwwsecu.irit.fr/redmine/attachments/download/341/updating.jpg!