我从简单的 Web 应用程序迁移到 Maven Web 应用程序,并使用 Eclipse Neon 遇到了一个令人沮丧的问题:在 pom.xml 中添加使用 Java 8 或 7 的规范后,它不起作用。
为了验证它是否有效,我编写了一个简单的类,在其中使用了 try(表达式) 声明。
我应该怎么做才能在 Maven 中使用 Java 8(我已经安装并且它可以在正常的 Web 应用程序中工作)?
pom.xml的代码是这样的:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.webdata</groupId>
<artifactId>WebParser</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>WebParser</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.23</version>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud) 我正在使用Google Maps API绘制两点路线,但此图给我带来了一些不便。当我绘制路线时,Google会在地图上向我显示两个点,即A和B,即起点和终点。
问题是我无法将其取出。我只需要显示没有此标记的路线。
有人知道如何仅显示路线吗?
该代码基于开发人员指南https://plnkr.co/edit/UWfKc7XGHtdbeRZkUS8X?p=preview中的示例
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Directions service (complex)</title>
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var startLatLng;
var endLatLng;
var startAddr …Run Code Online (Sandbox Code Playgroud)