MAY Maven Standalone Setup » Historique » Version 14
Anonyme, 10/10/2014 15:29
| 1 | 14 | Anonyme | h1. MAY Maven Standalone Setup |
|---|---|---|---|
| 2 | 1 | Anonyme | |
| 3 | 12 | Anonyme | h2. Use Cases |
| 4 | |||
| 5 | 2 | Anonyme | It is possible to use maven to generate code so that Eclipse is not needed anymore. |
| 6 | 10 | Anonyme | For example, one possible workflow is to use another IDE and executing |
| 7 | 11 | Anonyme | |
| 8 | 10 | Anonyme | <pre>mvn generate-sources</pre> |
| 9 | 11 | Anonyme | |
| 10 | 10 | Anonyme | after modifying the speadl file. |
| 11 | |||
| 12 | It is also included in all other maven calls such as: |
||
| 13 | |||
| 14 | <pre>mvn package</pre> |
||
| 15 | 12 | Anonyme | |
| 16 | 13 | Anonyme | All of this is of course compatible with the use of Eclipse (see the last section of this page on issues and their resolution). |
| 17 | |||
| 18 | 12 | Anonyme | h2. Modifying the POM File |
| 19 | 1 | Anonyme | |
| 20 | 2 | Anonyme | In order to do that, use the following POM file: |
| 21 | 1 | Anonyme | |
| 22 | <pre> |
||
| 23 | 7 | Anonyme | <project ...> |
| 24 | 1 | Anonyme | <modelVersion>4.0.0</modelVersion> |
| 25 | <groupId>XXX</groupId> |
||
| 26 | <artifactId>XXX</artifactId> |
||
| 27 | <version>XXX</version> |
||
| 28 | |||
| 29 | <properties> |
||
| 30 | 7 | Anonyme | <may-lib-version>3.3.0</may-lib-version> |
| 31 | 2 | Anonyme | <xtext-version>2.6.2</xtext-version> |
| 32 | 1 | Anonyme | <may-version>3.3.1</may-version> |
| 33 | </properties> |
||
| 34 | |||
| 35 | <dependencies> |
||
| 36 | <dependency> |
||
| 37 | <groupId>fr.irit.smac.lib.may</groupId> |
||
| 38 | <artifactId>common-components</artifactId> |
||
| 39 | <version>${may-lib-version}</version> |
||
| 40 | </dependency> |
||
| 41 | </dependencies> |
||
| 42 | |||
| 43 | 7 | Anonyme | <repositories> |
| 44 | <repository> |
||
| 45 | <id>fr.irit.smac</id> |
||
| 46 | <url>http://www.irit.fr/~Victor.Noel/maven-repos/</url> |
||
| 47 | </repository> |
||
| 48 | </repositories> |
||
| 49 | |||
| 50 | 9 | Anonyme | <pluginRepositories> |
| 51 | <pluginRepository> |
||
| 52 | <id>fr.irit.smac</id> |
||
| 53 | <url>http://www.irit.fr/~Victor.Noel/maven-repos/</url> |
||
| 54 | </pluginRepository> |
||
| 55 | </pluginRepositories> |
||
| 56 | |||
| 57 | 1 | Anonyme | <build> |
| 58 | 7 | Anonyme | <!-- This is already present in the default POM --> |
| 59 | <sourceDirectory>src</sourceDirectory> |
||
| 60 | <resources> |
||
| 61 | <resource> |
||
| 62 | <directory>src</directory> |
||
| 63 | <excludes> |
||
| 64 | <exclude>**/*.java</exclude> |
||
| 65 | </excludes> |
||
| 66 | </resource> |
||
| 67 | </resources> |
||
| 68 | 1 | Anonyme | <plugins> |
| 69 | 7 | Anonyme | <!-- This is already present in the default POM --> |
| 70 | 1 | Anonyme | <plugin> |
| 71 | 7 | Anonyme | <artifactId>maven-compiler-plugin</artifactId> |
| 72 | <version>3.1</version> |
||
| 73 | <configuration> |
||
| 74 | <source>1.7</source> |
||
| 75 | <target>1.7</target> |
||
| 76 | </configuration> |
||
| 77 | </plugin> |
||
| 78 | <!-- This configure the maven to take into account the SpeADL code --> |
||
| 79 | <plugin> |
||
| 80 | 1 | Anonyme | <groupId>org.codehaus.mojo</groupId> |
| 81 | <artifactId>build-helper-maven-plugin</artifactId> |
||
| 82 | <version>1.8</version> |
||
| 83 | <executions> |
||
| 84 | <execution> |
||
| 85 | <id>add-source</id> |
||
| 86 | <goals> |
||
| 87 | <goal>add-source</goal> |
||
| 88 | </goals> |
||
| 89 | <configuration> |
||
| 90 | <sources> |
||
| 91 | <source>speadl-gen</source> |
||
| 92 | </sources> |
||
| 93 | </configuration> |
||
| 94 | </execution> |
||
| 95 | 7 | Anonyme | <!-- The following is only needed so that speadl files are included |
| 96 | in the generated maven artifact --> |
||
| 97 | 1 | Anonyme | <execution> |
| 98 | <id>add-resource</id> |
||
| 99 | <goals> |
||
| 100 | <goal>add-resource</goal> |
||
| 101 | </goals> |
||
| 102 | <configuration> |
||
| 103 | 2 | Anonyme | <resources> |
| 104 | 1 | Anonyme | <resource> |
| 105 | 7 | Anonyme | <directory>${project.build.sourceDirectory}</directory> |
| 106 | 1 | Anonyme | <includes> |
| 107 | <include>**/*.speadl</include> |
||
| 108 | </includes> |
||
| 109 | </resource> |
||
| 110 | </resources> |
||
| 111 | </configuration> |
||
| 112 | </execution> |
||
| 113 | 2 | Anonyme | </executions> |
| 114 | </plugin> |
||
| 115 | 8 | Anonyme | <!-- This is needed cleaning the generated file before regenerating them |
| 116 | But not when doing a clean --> |
||
| 117 | 2 | Anonyme | <plugin> |
| 118 | <groupId>org.apache.maven.plugins</groupId> |
||
| 119 | <artifactId>maven-clean-plugin</artifactId> |
||
| 120 | <version>2.5</version> |
||
| 121 | <executions> |
||
| 122 | <execution> |
||
| 123 | <phase>generate-sources</phase> |
||
| 124 | <goals> |
||
| 125 | <goal>clean</goal> |
||
| 126 | </goals> |
||
| 127 | <configuration> |
||
| 128 | <excludeDefaultDirectories>true</excludeDefaultDirectories> |
||
| 129 | <filesets> |
||
| 130 | 1 | Anonyme | <fileset> |
| 131 | 2 | Anonyme | <directory>speadl-gen</directory> |
| 132 | </fileset> |
||
| 133 | </filesets> |
||
| 134 | </configuration> |
||
| 135 | </execution> |
||
| 136 | </executions> |
||
| 137 | </plugin> |
||
| 138 | 7 | Anonyme | <!-- This is needed for generating the file directly from maven --> |
| 139 | 2 | Anonyme | <plugin> |
| 140 | <groupId>org.eclipse.xtext</groupId> |
||
| 141 | <artifactId>xtext-maven-plugin</artifactId> |
||
| 142 | <version>${xtext-version}</version> |
||
| 143 | <executions> |
||
| 144 | <execution> |
||
| 145 | <goals> |
||
| 146 | <goal>generate</goal> |
||
| 147 | </goals> |
||
| 148 | </execution> |
||
| 149 | </executions> |
||
| 150 | <configuration> |
||
| 151 | <languages> |
||
| 152 | <language> |
||
| 153 | <setup>fr.irit.smac.may.speadl.SpeADLStandaloneSetup</setup> |
||
| 154 | <outputConfigurations> |
||
| 155 | <outputConfiguration> |
||
| 156 | <outputDirectory>speadl-gen</outputDirectory> |
||
| 157 | </outputConfiguration> |
||
| 158 | </outputConfigurations> |
||
| 159 | </language> |
||
| 160 | </languages> |
||
| 161 | </configuration> |
||
| 162 | <dependencies> |
||
| 163 | <dependency> |
||
| 164 | <groupId>fr.irit.smac.may</groupId> |
||
| 165 | <artifactId>fr.irit.smac.may.speadl</artifactId> |
||
| 166 | <version>${may-version}</version> |
||
| 167 | </dependency> |
||
| 168 | </dependencies> |
||
| 169 | 1 | Anonyme | </plugin> |
| 170 | </plugins> |
||
| 171 | </build> |
||
| 172 | </project> |
||
| 173 | </pre> |
||
| 174 | 3 | Anonyme | |
| 175 | 5 | Anonyme | h2. Possible Issues and Resolutions |
| 176 | 3 | Anonyme | |
| 177 | 6 | Anonyme | h3. Errors in the POM file |
| 178 | |||
| 179 | 5 | Anonyme | If the POM file contains the following errors in Eclipse: |
| 180 | 3 | Anonyme | |
| 181 | 5 | Anonyme | Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-clean-plugin:2.5:clean (execution: default, phase: generate-sources) |
| 182 | 1 | Anonyme | |
| 183 | 5 | Anonyme | and |
| 184 | 1 | Anonyme | |
| 185 | 5 | Anonyme | Plugin execution not covered by lifecycle configuration: org.eclipse.xtext:xtext-maven-plugin:2.6.2:generate (execution: default, phase: generate-sources) |
| 186 | 1 | Anonyme | |
| 187 | 5 | Anonyme | When hovering on the error, choose the following quickfix: |
| 188 | |||
| 189 | Permanently mark goal clean in pom.xml as ignored as ignored in Eclipse build. |
||
| 190 | |||
| 191 | and |
||
| 192 | |||
| 193 | Permanently mark goal generate in pom.xml as ignored as ignored in Eclipse build. |
||
| 194 | |||
| 195 | This will prevent the Maven plugin in Eclipse to generate the source code while Eclipse also does it internally. |