我将我的项目转换为maven.我在war文件中看到没有可用的类文件.
下面是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>RetailProducts</groupId>
<artifactId>RetailProducts</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>RetailProducts</name>
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
<!-- Tomcat 6 need this -->
<dependency>
<groupId>com.sun.el</groupId>
<artifactId>el-ri</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<finalName>JavaServerFaces</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<!-- <configuration> section added to pick up the WEB-INF/web.xml inside WebContent -->
<configuration> …Run Code Online (Sandbox Code Playgroud) 如何在java中模拟函数式编程,特别是将函数映射到项集合?
map(func, new String[]{"a","b","c"});
什么是最简单和最尴尬的方式呢?
我知道,对于每个类初始化,每个类都将扩展对象类.这是否意味着JVM将为自定义类和Object类创建一个对象?任何人都可以非常清楚地解释这个类的初始化过程.
编辑:
因此,如果我将任何超类扩展到子类,这个超类是否占用了子类的相同内存?
是否有任何代码,永远不会执行finally子句?
我的项目有4个类,它们分别是(titleScreen,credits,storyScreen和camapaign),因为它们相互连接,我不知道如何编译它.还有一件事是,当我使用命令(DOS/CMD)javac时,它仍然无效,说编译器找不到其他类,但它们作为一个类存在.我怎样才能编译它并让它工作?顺便说一下,它在控制台中或没有GUI,因此Netbeans中的Clean和Build不起作用.
我遇到了JumboEnumSet,但没有找到太多关于它的信息.
何时以及为什么我们使用JumboEnumSet.Please任何人都可以解释JumboEnumSet?
可能重复:
为什么要实现finalize()?
我看到一些带有以下代码的java文件:
public void finalize() {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
}
}
}
Run Code Online (Sandbox Code Playgroud)
Connection的finalize方法最好的做法?Connection或需要关闭其他对象,如PreparedStatement?我试图验证https url,但我得到例外.下面是代码.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;
public class Authenticate {
/**
* @param args
*/
public void authenticateUrl() {
HostnameVerifier hv = new HostnameVerifier() {
@Override
public boolean verify(String urlHostName, SSLSession session) {
System.out.println("Warning: URL Host: " + urlHostName
+ " vs. " + session.getPeerHost());
return true;
}
};
// Now you are telling the JRE to trust …Run Code Online (Sandbox Code Playgroud)