我知道我可以添加maven存储库来获取〜/ .m2/settings.xml中的依赖项.但是可以使用命令行添加存储库,例如:
mvn install -Dmaven.repository=http://example.com/maven2
Run Code Online (Sandbox Code Playgroud)
我想这样做的原因是因为我使用的是持续集成工具,我可以完全控制它用来调用maven的命令行选项,但是为运行集成工具的用户管理settings.xml有点麻烦.
使用Maven 2,有没有一种方法可以将jar依赖项列为文件名?
mvn dependency:build-classpath
Run Code Online (Sandbox Code Playgroud)
可以列出jar文件,但这将包括它们在我的本地存储库中的位置的完整路径.我需要的只是一个文件名列表(或复制依赖目标复制的文件名).
所以我需要的清单就像是
activation-1.1.jar,antlr-2.7.6.jar,aopalliance-1.0.jar etc...
Run Code Online (Sandbox Code Playgroud)
理想情况下,作为maven属性,但我想,像build-classpath这样的文件可以生成.
我想要实现的是Bundle-ClassPath
为OSGi包编写一个手动维护的MANIFEST.MF文件.(您不应该理解这一点来回答这个问题.)
澄清一下:问题不在于如何将清单头文件写入jar中的MANIFEST.MF文件中(很容易google).我问的是如何获取我想要写的数据,即上面显示的列表.
我有一个使用mercurial进行版本控制的项目,我正在尝试在Eclipse中进行设置.我从命令行克隆了项目,然后通过将其作为maven项目导入,在eclipse中打开了项目.
除了eclipse/MercurialEclipse似乎没有发现这是一个merurial repo之外,这个工作正常.
如果我转到项目属性,Mercurial选项只显示消息"此项目不使用MercurialEclipse作为团队提供者".
在"Team Synchronizing"透视图中,Synchronize ...只是给了我一个"克隆存储库向导",说"没有Mercurial资源可以同步".
有谁知道如何让MercurialEclipse获取项目的现有存储库.
我正在尝试在Solaris机器上调试java进程的一些问题,但是运行jps不会返回任何输出.并且jstack给出错误'Permission denied'.该框是3个相同服务器集群的一部分,jps和jstack在其他2台服务器上运行良好.
我发现以下论坛帖子来自有同样问题但没有答案的人:http: //forums.sun.com/thread.jspa?threadID = 5422237
澄清运行bps和grep for java给出了所有java程序正确,但是jps没有给出任何东西(用'program'和'client'匿名来保护有罪):
program @ clientdelivery2 : ~/
-> bps auxww|grep java
program 3427 5.5 54.067742726649544 ? S Sep 25 1039:47 /usr/jdk/instances/jdk1.6.0_16/bin/amd64/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/app/client/program/tomcat/conf/logging.properties -Xmx6144m -XX:PermSize=128m -XX:MaxPermSize=512m -Djava.endorsed.dirs=/app/client/program/tomcat/endorsed -classpath :/app/client/program/tomcat/bin/bootstrap.jar -Dcatalina.base=/app/client/program/tomcat -Dcatalina.home=/app/client/program/tomcat -Djava.io.tmpdir=/app/client/program/tomcat/temp org.apache.catalina.startup.Bootstrap start
program 29915 0.1 11.915252441467896 ? S 14:55:28 3:59 /usr/jdk/instances/jdk1.6.0_16/bin/amd64/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/app/clientclone/program/tomcat/conf/logging.properties -Xmx2g -XX:PermSize=128m -XX:MaxPermSize=512m -Dcom.sun.management.jmxremote -Djava.endorsed.dirs=/app/clientclone/program/tomcat/endorsed -classpath :/app/clientclone/program/tomcat/bin/bootstrap.jar -Dcatalina.base=/app/clientclone/program/tomcat -Dcatalina.home=/app/clientclone/program/tomcat -Djava.io.tmpdir=/app/clientclone/program/tomcat/temp org.apache.catalina.startup.Bootstrap start
program 1573 0.0 0.0 4760 1332 pts/5 S 17:05:24 0:00 grep --colour java
program …
Run Code Online (Sandbox Code Playgroud) 默认情况下,IntelliJ IDEA 7.0.4似乎在XML文件中使用4个空格进行缩进.我正在研究的项目在它的所有XML中使用2个空格作为缩进.有没有办法在IntelliJ的编辑器中配置缩进?
我正在尝试为生成war文件的Maven项目设置集成测试.(如此处所见http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin/.)但是我的war文件需要在类路径上有一堆.properties文件,我不想捆绑在战争中.
有没有办法(最好是通过插件配置)将文件夹添加到jetty使用的类路径中?
我用Google搜索并发现了http://markmail.org/message/awtqrgxxttra3uxx但据我所知,这根本不起作用.找不到.properties文件.
我在一个基本上收集日志记录信息的表上经常进行以下两个查询.两者都从大量行中选择不同的值,但这些值中的值不到10个.
我已经分析了页面完成的两个"不同"查询:
marchena=> explain select distinct auditrecor0_.bundle_id as col_0_0_ from audit_records auditrecor0_;
QUERY PLAN
----------------------------------------------------------------------------------------------
HashAggregate (cost=1070734.05..1070734.11 rows=6 width=21)
-> Seq Scan on audit_records auditrecor0_ (cost=0.00..1023050.24 rows=19073524 width=21)
(2 rows)
marchena=> explain select distinct auditrecor0_.server_name as col_0_0_ from audit_records auditrecor0_;
QUERY PLAN
----------------------------------------------------------------------------------------------
HashAggregate (cost=1070735.34..1070735.39 rows=5 width=13)
-> Seq Scan on audit_records auditrecor0_ (cost=0.00..1023051.47 rows=19073547 width=13)
(2 rows)
Run Code Online (Sandbox Code Playgroud)
两者都对列进行序列扫描.但是,如果我关闭enable_seqscan(显示名称,这只会禁用对带索引的列进行序列扫描),查询将使用索引,但速度更慢:
marchena=> set enable_seqscan = off;
SET
marchena=> explain select distinct auditrecor0_.bundle_id as col_0_0_ from audit_records auditrecor0_;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
Unique (cost=0.00..19613740.62 …
Run Code Online (Sandbox Code Playgroud) 我使用Hibernate注释有如下关系,这是我尝试过的:
public class Job{
...
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(name = "jobs_resource_locations")
@ForeignKey(name = "job_inputs_fk")
@Index(name="job_inputs_fk")
private List<FileSystemLocation> inputs;
Run Code Online (Sandbox Code Playgroud)
这样的事情很好地适用于ManyToOne,如下所示:
@ManyToOne
@JoinColumn(name = "service_call_id", referencedColumnName = "id")
@ForeignKey(name = "job_service_call_fk")
@Index(name = "job_service_call_fk")
private ServiceCall serviceCall;
Run Code Online (Sandbox Code Playgroud)
我想确保外键在PostgreSQL上被索引,并且模式在MySQL上看起来类似,因此@ForeignKey和@Index具有相同的名称(MySQL总是创建一个与FK同名的索引).
我不能在反面创建索引,因为FileSystemLocation不知道这种关系.因此JoinTable.
前一个示例失败,因为Hibernate在Job中找不到要索引的列:
org.hibernate.MappingException: Unable to find logical column name from physical name null in table jobs
Run Code Online (Sandbox Code Playgroud)
有谁知道如何使用Hibernate在JoinTable外键上创建索引?
我知道你可以打电话
Runtime.getRuntime().exec(file);
Run Code Online (Sandbox Code Playgroud)
如果它不可执行,则获得异常,但这是不安全的,因为运行可执行文件可能会产生副作用.
我想只是在Windows上检查扩展是否足够,但有没有办法可以读取*nix文件系统上的可执行位?
找出文件在OS中是否可执行的最佳方法是什么?
我正在使用JACOB从Java对PowerPoint和其他Office应用程序进行COM调用.在特定的Windows 7机器上,我经常收到以下消息,但并非总是如此:
Source: Microsoft Office PowerPoint 2007
Description: PowerPoint could not open the file.
Run Code Online (Sandbox Code Playgroud)
从excel我得到:
ERROR - Invoke of: Open
Source: Microsoft Office Excel
Description: Microsoft Office Excel cannot access the file 'c:\marchena\marchena10\work\marchena\batch_58288\input\content_1.xlsx'. There are several possible reasons:
? The file name or path does not exist.
? The file is being used by another program.
? The workbook you are trying to save has the same name as a currently open workbook.
Run Code Online (Sandbox Code Playgroud)
Word错误只是:
VariantChangeType failed
Run Code Online (Sandbox Code Playgroud)
以下是我正在运行的,错误来自最后一行.
ComThread.InitSTA();
slideApp = …
Run Code Online (Sandbox Code Playgroud)