我在SpringSource Tool Suite中创建了一个新的maven项目.我在新的maven项目中遇到此错误.
无法转移org.apache.maven.plugins:来自http://repo1.maven.org/maven2的 maven-surefire-plugin:pom:2.7.1 被缓存在本地存储库中,在更新间隔之前不会重新尝试解析中心已经过去或强制更新.原始错误:无法传输工件org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from/to central(http://repo1.maven.org/maven2):连接超时
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.test.app</groupId>
<artifactId>TestApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>TestApp</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
将Settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
</pluginGroups>
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>user</username>
<password>pass</password>
<host>ip</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
<servers>
</servers>
<mirrors>
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
</mirrors>
<profiles>
</profiles>
</settings>
Run Code Online (Sandbox Code Playgroud)
请注意,我能够构建它.在IDE中的pom.xml中显示错误.任何解决方案?
我正在尝试将hibernate orm映射工具配置到我的java类并使用PostgreSQL作为我的数据库并将密码配置为"密码".当我尝试运行应用程序时,我在控制台日志上遇到错误,因为 无法创建请求的服务[org.hibernate.engine.jdbc.env.spi.JdbcEnvironment].我在旧版本的hibernate上试过这个并且它有效.我现在使用的hibernate版本是5.1.0版.
以下是错误日志:
Mar 31, 2016 3:55:09 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.1.0.Final}
Mar 31, 2016 3:55:09 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Mar 31, 2016 3:55:09 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Mar 31, 2016 3:55:09 PM org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity
WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-configuration. Use namespace http://www.hibernate.org/dtd/hibernate-configuration instead. Support for obsolete DTD/XSD namespaces may be removed at any time.
Mar 31, 2016 3:55:10 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: …Run Code Online (Sandbox Code Playgroud) 我正在Spring应用程序中学习JPA,我对@Entity注释有一些疑问.
所以我有一个这样的模型类:
@Entity
@Table(name= “T_CUSTOMER”)
public class Customer {
@Id
@Column(name=“cust_id”)
private Long id;
@Column(name=“first_name”)
private String firstName;
@Transient
private User currentUser;
...........................
...........................
...........................
}
Run Code Online (Sandbox Code Playgroud)
好的,我知道@Entity注释是在类级别上,这意味着作为此类实例的对象的字段将映射到T_CUSTOMER数据库表的字段.
但是为什么在JPA中必须使用@Entity注释,我不仅可以使用@Table注释将模型对象映射到特定的数据库表?它有一些其他意义\行为,实际上我错过了?
我错过了什么?@Entity注释的确切含义是什么?
我试图通过下载.exe文件来安装node.js,我很困惑并且坚持在Node.js设置中,其中要求安装node.js运行时或npm包管理器, 所以我想在知道后继续安装完全是两者之间的区别.
我的问题是node.js运行时和npm pacakage管理器之间有什么区别,我对这两个选项有什么功能.
我编写了代码来查找两个给定文件夹(路径)之间的公共文件,这些文件夹占所有级别的子文件夹(如果存在).
请建议是否有更有效的方法.如果给出具有多级子文件夹的文件夹,则花费太长时间.
def findCommonDeep(self,path1,path2):
commonfiles = []
for (dirpath1, dirname1, filenames1) in os.walk(path1):
for file in filenames1:
for (dirpath2, dirname2, filenames2) in os.walk(path2):
if (file in filenames2 and isfile(join(dirpath2, file))):
commonfiles.append(file)
print(commonfiles)
Run Code Online (Sandbox Code Playgroud)
并使用路径调用此函数,如下所示:
findCommonDeep("/home/naseer/Python", "/home/naseer/C")
Run Code Online (Sandbox Code Playgroud)
据我所知,如果我存储任何给定路径的所有文件的列表,则可以降低执行速度.但我想这会耗尽内存.请指导我更有效地接近这个.
这是官方python文档中给出的用于打印Fibonacci系列的代码.
我不明白为什么这个代码运行到无穷大,因为while循环条件没有问题.
def fib(n):
a, b = 0, 1
while a < n:
print a,
a, b = b, a + b
number = raw_input("What's the number you want to get Fibonacci series up to?")
fib(number)
Run Code Online (Sandbox Code Playgroud) 以下是我的代码.编译器生成错误
#include<stdio.h>
struct Shelf{
int clothes;
int *books;
};
struct Shelf b;
b.clothes=5;
*(b.books)=6;
Run Code Online (Sandbox Code Playgroud)
编译器为语句b.clothes=5;和b->books=6;上面的代码生成如下错误.
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘->’ token
Run Code Online (Sandbox Code Playgroud)
我不是C的初学者,我相信我所写的是正确的.请解决我的问题