5050 * A project-based GWT SDK for Maven-based project.
5151 */
5252public class GWTMavenRuntime extends ProjectBoundSdk {
53+
5354 public static final String MAVEN_GWT_GROUP_ID = "com.google.gwt" ;
5455 public static final String MAVEN_GWT_DEV_JAR_ARTIFACT_ID = "gwt-dev" ;
5556 public static final String MAVEN_GWT_USER_ARTIFACT_ID = "gwt-user" ;
@@ -92,11 +93,10 @@ public URLClassLoader createClassLoader() throws SdkException, MalformedURLExcep
9293 * This method's implementation breaks the general contract of
9394 * {@link com.google.gwt.eclipse.core.runtime.GwtSdk#getClasspathEntries()} .
9495 *
95- * The general contract states that the entries returned should be the raw entries on the build
96- * path that correspond to the SDK. This method returns the resolved entry on the build path that
97- * corresponds to the gwt-user library. It then returns the path to the gwt-dev library that's a
98- * peer of the gwt-user library in the Maven repository. This library may not be on the build
99- * classpath.
96+ * The general contract states that the entries returned should be the raw entries on the build path that correspond
97+ * to the SDK. This method returns the resolved entry on the build path that corresponds to the gwt-user library. It
98+ * then returns the path to the gwt-dev library that's a peer of the gwt-user library in the Maven repository. This
99+ * library may not be on the build classpath.
100100 *
101101 * TODO: Reconsider the general contract of this method.
102102 *
@@ -115,8 +115,7 @@ public IClasspathEntry[] getClasspathEntries() {
115115 File gwtDevJar = getDevJar ();
116116
117117 if (gwtDevJar != null ) {
118- classpathEntries .add (JavaCore .newLibraryEntry (
119- Path .fromOSString (gwtDevJar .getAbsolutePath ()), null , null ));
118+ classpathEntries .add (JavaCore .newLibraryEntry (Path .fromOSString (gwtDevJar .getAbsolutePath ()), null , null ));
120119 }
121120 }
122121
@@ -134,19 +133,11 @@ public int compare(IClasspathEntry o1, IClasspathEntry o2) {
134133
135134 return classpathEntryArray ;
136135 } catch (JavaModelException e ) {
137- Activator
138- .getDefault ()
139- .getLog ()
140- .log (
141- new Status (IStatus .ERROR , Activator .PLUGIN_ID ,
142- "Unable to generate classpath entries for the maven-based GWT runtime." , e ));
136+ Activator .getDefault ().getLog ().log (new Status (IStatus .ERROR , Activator .PLUGIN_ID ,
137+ "Unable to generate classpath entries for the maven-based GWT runtime." , e ));
143138 } catch (SdkException sdke ) {
144- Activator
145- .getDefault ()
146- .getLog ()
147- .log (
148- new Status (IStatus .ERROR , Activator .PLUGIN_ID ,
149- "Unable to generate classpath entries for the maven-based GWT runtime." , sdke ));
139+ Activator .getDefault ().getLog ().log (new Status (IStatus .ERROR , Activator .PLUGIN_ID ,
140+ "Unable to generate classpath entries for the maven-based GWT runtime." , sdke ));
150141 }
151142
152143 return AbstractSdk .NO_ICLASSPATH_ENTRIES ;
@@ -160,9 +151,8 @@ public File getDevJar() throws SdkException, JavaModelException {
160151 throw new SdkException ("Unable to locate gwt-user.jar" );
161152 }
162153
163- IPath path =
164- MavenUtils .getArtifactPathForPeerMavenArtifact (classpathEntry .getPath (),
165- MAVEN_GWT_GROUP_ID , MAVEN_GWT_DEV_JAR_ARTIFACT_ID );
154+ IPath path = MavenUtils .getArtifactPathForPeerMavenArtifact (classpathEntry .getPath (), MAVEN_GWT_GROUP_ID ,
155+ MAVEN_GWT_DEV_JAR_ARTIFACT_ID );
166156 if (path == null ) {
167157 throw new SdkException ("Unable to locate gwt-dev.jar" );
168158 }
@@ -175,8 +165,8 @@ public File getDevJar() throws SdkException, JavaModelException {
175165 }
176166
177167 /**
178- * Maven-based GWT SDKs do not have a clear installation path. So, we say that the installation
179- * path corresponds to: <code><repository path>/<group path></code>.
168+ * Maven-based GWT SDKs do not have a clear installation path. So, we say that the installation path corresponds to:
169+ * <code><repository path>/<group path></code>.
180170 */
181171 @ Override
182172 public IPath getInstallationPath () {
@@ -193,20 +183,15 @@ public IPath getInstallationPath() {
193183 }
194184 return p .removeLastSegments (3 );
195185 } catch (JavaModelException e ) {
196- Activator
197- .getDefault ()
198- .getLog ()
199- .log (
200- new Status (IStatus .ERROR , Activator .PLUGIN_ID ,
201- "Unable to determine installation path for the maven-based GWT runtime." , e ));
186+ Activator .getDefault ().getLog ().log (new Status (IStatus .ERROR , Activator .PLUGIN_ID ,
187+ "Unable to determine installation path for the maven-based GWT runtime." , e ));
202188 }
203189
204190 return null ;
205191 }
206192
207193 /**
208- * Maven-based sdks do not contribute libraries that should be placed in the
209- * <code>WEB-INF/lib</code> folder.
194+ * Maven-based sdks do not contribute libraries that should be placed in the <code>WEB-INF/lib</code> folder.
210195 */
211196 @ Override
212197 public File [] getWebAppClasspathFiles (IProject project ) {
@@ -230,14 +215,13 @@ public IStatus validate() {
230215 * @throws JavaModelException
231216 */
232217 private IClasspathEntry findGwtCodeServerClasspathEntry () throws JavaModelException {
233- IType type =
234- javaProject .findType (GwtLaunchConfigurationProcessorUtilities .GWT_CODE_SERVER );
218+ IType type = javaProject .findType (GwtLaunchConfigurationProcessorUtilities .GWT_CODE_SERVER );
235219 if (type == null ) {
236220 return null ;
237221 }
238222
239- IPackageFragmentRoot packageFragmentRoot =
240- ( IPackageFragmentRoot ) type .getAncestor (IJavaElement .PACKAGE_FRAGMENT_ROOT );
223+ IPackageFragmentRoot packageFragmentRoot = ( IPackageFragmentRoot ) type
224+ .getAncestor (IJavaElement .PACKAGE_FRAGMENT_ROOT );
241225 if (packageFragmentRoot .getKind () == IPackageFragmentRoot .K_BINARY ) {
242226 return JavaCore .newLibraryEntry (packageFragmentRoot .getPath (), null , null );
243227 }
@@ -247,10 +231,10 @@ private IClasspathEntry findGwtCodeServerClasspathEntry() throws JavaModelExcept
247231
248232 private IClasspathEntry findGwtUserClasspathEntry () throws JavaModelException {
249233 /*
250- * Note that the type that we're looking for to determine if we're part of the gwt-user library
251- * is different than the one that is used by the superclass. This is because the class that the
252- * superclass is querying for, "com.google.gwt.core.client.GWT", also exists in the gwt-servlet
253- * library, and for some reason, this sometimes ends up on the build path for Maven projects.
234+ * Note that the type that we're looking for to determine if we're part of the gwt-user library is different than
235+ * the one that is used by the superclass. This is because the class that the superclass is querying for,
236+ * "com.google.gwt.core.client.GWT", also exists in the gwt-servlet library, and for some reason, this sometimes
237+ * ends up on the build path for Maven projects.
254238 *
255239 * TODO: See why Maven is putting gwt-servlet on the build path.
256240 *
@@ -262,8 +246,8 @@ private IClasspathEntry findGwtUserClasspathEntry() throws JavaModelException {
262246 return null ;
263247 }
264248
265- IPackageFragmentRoot packageFragmentRoot =
266- ( IPackageFragmentRoot ) type .getAncestor (IJavaElement .PACKAGE_FRAGMENT_ROOT );
249+ IPackageFragmentRoot packageFragmentRoot = ( IPackageFragmentRoot ) type
250+ .getAncestor (IJavaElement .PACKAGE_FRAGMENT_ROOT );
267251 if (packageFragmentRoot .getKind () == IPackageFragmentRoot .K_BINARY ) {
268252 // TODO: If the Maven javadoc and source libs for gwt-dev.jar are
269253 // available, attach them here.
@@ -280,12 +264,13 @@ private IClasspathEntry findJavaXValidationClasspathEntry() throws JavaModelExce
280264 return null ;
281265 }
282266
283- IPackageFragmentRoot packageFragmentRoot =
284- ( IPackageFragmentRoot ) type .getAncestor (IJavaElement .PACKAGE_FRAGMENT_ROOT );
267+ IPackageFragmentRoot packageFragmentRoot = ( IPackageFragmentRoot ) type
268+ .getAncestor (IJavaElement .PACKAGE_FRAGMENT_ROOT );
285269 if (packageFragmentRoot .getKind () == IPackageFragmentRoot .K_BINARY ) {
286270 return JavaCore .newLibraryEntry (packageFragmentRoot .getPath (), null , null );
287271 }
288272
289273 return null ;
290274 }
275+
291276}
0 commit comments