Skip to content

Commit 40a53da

Browse files
authored
require version on maven coordinates (#1537)
* require version on maven coordinates * objectify 5.1.15 * fix tests * indents * never put LATEST into version element in pom.xml * fix Pomtest
1 parent 6b53237 commit 40a53da

5 files changed

Lines changed: 59 additions & 54 deletions

File tree

plugins/com.google.cloud.tools.eclipse.appengine.libraries.test/src/com/google/cloud/tools/eclipse/appengine/libraries/AppEngineLibrariesInPluginXmlTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void testAppEngineApiLibraryConfig() throws URISyntaxException {
7676
assertThat(mavenCoordinates.getRepository(), is("central"));
7777
assertThat(mavenCoordinates.getGroupId(), is("com.google.appengine"));
7878
assertThat(mavenCoordinates.getArtifactId(), is("appengine-api-1.0-sdk"));
79-
assertThat(mavenCoordinates.getVersion(), is("LATEST"));
79+
assertThat(mavenCoordinates.getVersion(), is("1.9.50"));
8080
assertThat(mavenCoordinates.getType(), is("jar"));
8181
assertNull(mavenCoordinates.getClassifier());
8282

@@ -118,7 +118,7 @@ public void testEndpointsLibraryConfig() throws URISyntaxException {
118118
assertThat(mavenCoordinates.getRepository(), is("central"));
119119
assertThat(mavenCoordinates.getGroupId(), is("com.google.appengine"));
120120
assertThat(mavenCoordinates.getArtifactId(), is("appengine-endpoints"));
121-
assertThat(mavenCoordinates.getVersion(), is("LATEST"));
121+
assertThat(mavenCoordinates.getVersion(), is("1.9.50"));
122122
assertThat(mavenCoordinates.getType(), is("jar"));
123123
assertNull(mavenCoordinates.getClassifier());
124124
assertThat(libraryFile.getJavadocUri(),
@@ -153,7 +153,7 @@ public void testObjectifyLibraryConfig() throws URISyntaxException {
153153
assertThat(objectifyMavenCoordinates.getRepository(), is("central"));
154154
assertThat(objectifyMavenCoordinates.getGroupId(), is("com.googlecode.objectify"));
155155
assertThat(objectifyMavenCoordinates.getArtifactId(), is("objectify"));
156-
assertThat(objectifyMavenCoordinates.getVersion(), is("5.1.14"));
156+
assertThat(objectifyMavenCoordinates.getVersion(), is("5.1.15"));
157157
assertThat(objectifyMavenCoordinates.getType(), is("jar"));
158158
assertNull(objectifyMavenCoordinates.getClassifier());
159159

plugins/com.google.cloud.tools.eclipse.appengine.libraries.test/src/com/google/cloud/tools/eclipse/appengine/libraries/PomTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ public void testAddDependencies()
124124
Assert.assertEquals("com.example.group3", groupId3.getTextContent());
125125
Element artifactId3 = getOnlyChild(child3, "artifactId");
126126
Assert.assertEquals("artifact3", artifactId3.getTextContent());
127-
Element version3 = getOnlyChild(child3, "version");
128-
Assert.assertEquals("LATEST", version3.getTextContent());
129127

130128
// now make sure the comment didn't move to the end
131129
// https://bugs.openjdk.java.net/browse/JDK-8146163

plugins/com.google.cloud.tools.eclipse.appengine.libraries.test/xsd/com.google.cloud.tools.eclipse.appengine.libraries.xsd

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
name="App Engine Libraries"/>
88
</xs:appinfo>
99
<xs:documentation>
10-
Provides an extension point to define libraries that will be resolved using the
11-
Maven coordinates. These libraries then can be added to App Engine projects.
10+
Provides an extension point to define libraries that will be resolved using the
11+
Maven coordinates. These libraries then can be added to App Engine projects.
1212
</xs:documentation>
1313
</xs:annotation>
1414

@@ -82,10 +82,10 @@ limitations under the License.
8282

8383
<xs:element name="library">
8484
<xs:annotation>
85-
<xs:documentation>
86-
An App Engine library that can consist of one or more jar files with associated
87-
visibility rules and Maven coordinates.
88-
</xs:documentation>
85+
<xs:documentation>
86+
An App Engine library that can consist of one or more jar files with associated
87+
visibility rules and Maven coordinates.
88+
</xs:documentation>
8989
</xs:annotation>
9090
<xs:complexType>
9191
<xs:sequence>
@@ -121,14 +121,14 @@ limitations under the License.
121121
<xs:annotation>
122122
<xs:documentation>
123123
A user-friendly name for the library that can be displayed in the UI,
124-
e.g.: "AppEngine Endpoints".
124+
e.g.: "App Engine Endpoints".
125125
</xs:documentation>
126126
</xs:annotation>
127127
</xs:attribute>
128128
<xs:attribute name="recommendation" type="recommendationType">
129129
<xs:annotation>
130130
<xs:documentation>
131-
Recommendation of the library, e.g.: if the library is required,
131+
Recommendation of the library. E.g.: if the library is required,
132132
it must always be added to the
133133
classpath of projects. Defaults to &lt;tt&gt;optional&lt;/tt&gt;.
134134
</xs:documentation>
@@ -138,7 +138,7 @@ limitations under the License.
138138
<xs:annotation>
139139
<xs:documentation>
140140
URL for more
141-
detailed information about the library, e.g. user guides, wiki, other documentation.
141+
detailed information about the library; e.g. user guides, wiki, other documentation.
142142
</xs:documentation>
143143
</xs:annotation>
144144
</xs:attribute>
@@ -193,9 +193,9 @@ unspecified, the javadoc will be downloaded from the artifact location if availa
193193
</xs:attribute>
194194
<xs:attribute name="sourceUri" type="xs:anyURI">
195195
<xs:annotation>
196-
<xs:documentation>
197-
URI that can be used by the IDE to lookup sources for the classes contained in this artifact. If
198-
unspecified, the source will be downloaded from the artifact location if available.
196+
<xs:documentation>
197+
URI that can be used by the IDE to lookup sources for the classes contained in this artifact. If
198+
unspecified, the source will be downloaded from the artifact location if available.
199199
</xs:documentation>
200200
</xs:annotation>
201201
</xs:attribute>
@@ -205,8 +205,8 @@ unspecified, the source will be downloaded from the artifact location if availab
205205
<xs:element name="libraryDependency">
206206
<xs:annotation>
207207
<xs:documentation>
208-
An id of another library defined through this extension point that must be also added to the classpath of
209-
the project, if this library is added.
208+
An id of another library defined through this extension point that must be also added to the
209+
classpath of the project, if this library is added.
210210
</xs:documentation>
211211
</xs:annotation>
212212
<xs:complexType>
@@ -217,8 +217,8 @@ the project, if this library is added.
217217
<xs:element name="exclusionFilter">
218218
<xs:annotation>
219219
<xs:documentation>
220-
A pattern that can be used to exclude classes and packages to be visible. Uses the same format as the JDT's
221-
build path <a href="http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fcore%2FIClasspathEntry.html&amp;anchor=getExclusionPatterns--">inclusion/exclusion filters</a>
220+
A pattern that can be used to exclude classes and packages to be visible.
221+
Uses the same format as the JDT's build path <a href="http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fcore%2FIClasspathEntry.html&amp;anchor=getExclusionPatterns--">inclusion/exclusion filters</a>
222222
</xs:documentation>
223223
</xs:annotation>
224224
<xs:complexType>
@@ -229,8 +229,11 @@ build path <a href="http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.
229229
<xs:element name="inclusionFilter">
230230
<xs:annotation>
231231
<xs:documentation>
232-
A pattern that can be used to include classes and packages to be visible. Uses the same format as the JDT's
233-
build path <a href="http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fcore%2FIClasspathEntry.html&amp;anchor=getInclusionPatterns--">inclusion/exclusion filters</a>
232+
A pattern that can be used to include classes and packages to be
233+
visible. Uses the same format as the JDT's
234+
build path
235+
<a
236+
href="http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fcore%2FIClasspathEntry.html&amp;anchor=getInclusionPatterns--">inclusion/exclusion filters</a>
234237
</xs:documentation>
235238
</xs:annotation>
236239
<xs:complexType>
@@ -250,39 +253,36 @@ build path <a href="http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.
250253
however it has an invalid attribute (value) and and invalid attribute value (default for use)
251254
according to the schema, so these are removed here -->
252255
<xs:attribute name="repositoryUri" type="xs:string">
253-
<xs:annotation>
254-
<xs:documentation>
255-
URI pointing to a repository location or an ID of a repository defined in the POM or the Maven
256-
settings. If the value starts with [protocol]:// then it is treated as a URI, otherwise an ID of a repository that is
257-
expected to be defined. Defaults to 'central' denoting the Maven Central repository.
256+
<xs:annotation>
257+
<xs:documentation>
258+
URL pointing to a repository location or the ID of a repository defined
259+
in the POM or the Maven settings. If the value starts with [protocol]://
260+
then it is treated as a URI. Otherwise it is treated as an ID of a repository.
261+
Defaults to 'central' denoting the Maven Central repository.
258262
</xs:documentation>
259263
</xs:annotation>
260264
</xs:attribute>
261265
<xs:attribute name="groupId" type="xs:string" use="required" />
262266
<xs:attribute name="artifactId" type="xs:string" use="required" />
263-
<!-- the original exsd contains this line
264-
<xs:attribute name="version" type="xs:string" use="default" value="LATEST">
265-
however it has an invalid attribute (value) and and invalid attribute value (default for use)
266-
according to the schema, so these are removed here -->
267-
<xs:attribute name="version" type="xs:string">
268-
<xs:annotation>
269-
<xs:documentation>
270-
Version of the maven artifact, defaults to LATEST.
271-
</xs:documentation>
272-
</xs:annotation>
267+
<xs:attribute name="version" type="xs:string" use="required">
268+
<xs:annotation>
269+
<xs:documentation>
270+
Version of the Maven artifact.
271+
</xs:documentation>
272+
</xs:annotation>
273273
</xs:attribute>
274274
<xs:attribute name="type" type="xs:string">
275-
<xs:annotation>
276-
<xs:documentation>
277-
The packaging type of the artifact, e.g. jar, war, zip. Currently only jar is supported.
278-
</xs:documentation>
279-
</xs:annotation>
275+
<xs:annotation>
276+
<xs:documentation>
277+
The packaging type of the artifact, e.g. jar, war, zip. Currently only
278+
jar is supported.
279+
</xs:documentation>
280+
</xs:annotation>
280281
</xs:attribute>
281282
<xs:attribute name="classifier" type="xs:string" />
282283
</xs:complexType>
283284
</xs:element>
284285

285-
286286
<xs:annotation>
287287
<xs:appinfo>
288288
<xs:meta.section type="xs:examples"/>
@@ -325,7 +325,8 @@ will determine how to resolve the entries associated with the container.
325325
<meta.section type="xs:implementation"/>
326326
</xs:appinfo>
327327
<xs:documentation>
328-
See the plugin.xml of the com.google.cloud.tools.eclipse.appengine.libraries for an example of how to contribute to the extension point.
328+
See the plugin.xml of the com.google.cloud.tools.eclipse.appengine.libraries for an example of how
329+
to contribute to the extension point.
329330
</xs:documentation>
330331
</xs:annotation>
331332

plugins/com.google.cloud.tools.eclipse.appengine.libraries/plugin.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
name="App Engine API"
1313
tooltip="%appengine.api.tooltip"
1414
siteUri="https://cloud.google.com/appengine/docs/java/" >
15-
<libraryFile
16-
javadocUri="https://cloud.google.com/appengine/docs/java/javadoc/">
15+
<libraryFile javadocUri="https://cloud.google.com/appengine/docs/java/javadoc/">
1716
<mavenCoordinates
1817
artifactId="appengine-api-1.0-sdk"
19-
groupId="com.google.appengine" />
18+
groupId="com.google.appengine"
19+
version="1.9.50" />
2020
<exclusionFilter pattern="com/google/appengine/repackaged/**" />
2121
<exclusionFilter pattern="com/google/appengine/labs/repackaged/**" />
2222
<inclusionFilter pattern="com/google/apphosting/api/**" />
@@ -34,7 +34,8 @@
3434
javadocUri="https://cloud.google.com/appengine/docs/java/endpoints/javadoc/">
3535
<mavenCoordinates
3636
artifactId="appengine-endpoints"
37-
groupId="com.google.appengine" />
37+
groupId="com.google.appengine"
38+
version="1.9.50" />
3839
<exclusionFilter pattern="com/google/appengine/repackaged/**" />
3940
</libraryFile>
4041
</library>
@@ -50,7 +51,7 @@
5051
<mavenCoordinates
5152
artifactId="objectify"
5253
groupId="com.googlecode.objectify"
53-
version="5.1.14" />
54+
version="5.1.15" />
5455
</libraryFile>
5556
<libraryFile
5657
javadocUri="https://google.github.io/guava/releases/20.0/api/docs/">

plugins/com.google.cloud.tools.eclipse.appengine.libraries/src/com/google/cloud/tools/eclipse/appengine/libraries/Pom.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,18 @@ void addDependencies(List<Library> libraries) throws CoreException {
9999
if (!dependencyExists(dependencies, groupId, artifactId)) {
100100
Element groupIdElement = document.createElement("groupId");
101101
groupIdElement.setTextContent(groupId);
102+
dependency.appendChild(groupIdElement);
103+
102104
Element artifactIdElement = document.createElement("artifactId");
103105
artifactIdElement.setTextContent(artifactId);
104-
Element versionElement = document.createElement("version");
105-
versionElement.setTextContent(coordinates.getVersion());
106-
dependency.appendChild(groupIdElement);
107106
dependency.appendChild(artifactIdElement);
108-
dependency.appendChild(versionElement);
107+
108+
String version = coordinates.getVersion();
109+
if (!MavenCoordinates.LATEST_VERSION.equals(version)) {
110+
Element versionElement = document.createElement("version");
111+
versionElement.setTextContent(version);
112+
dependency.appendChild(versionElement);
113+
}
109114

110115
dependencies.appendChild(dependency);
111116
}

0 commit comments

Comments
 (0)