我正在设置一个具有扁平结构的多模块项目,即父级和子级位于同一个基本目录中.父级定义为
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>company</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1-0-SNAPSHOT</version>
<name>child</name>
<modules>
<module>../child</module>
</modules>
(...)
Run Code Online (Sandbox Code Playgroud)
而它所定义的孩子
<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/maven-v4_0_0.xsd">
<parent>
<groupId>company</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>company</groupId>
<artifactId>child/artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>child</name>
(...)
Run Code Online (Sandbox Code Playgroud)
(公司和项目名称混淆)
发生的是模块(子)抱怨它找不到父,即:
Reason: Cannot find parent: company:child for project: company:child:war:1.0-SNAPSHOT for project company:child:war:1.0-SNAPSHOT
Run Code Online (Sandbox Code Playgroud)
有没有明显的解决方案,我错过了,或者建议使用扁平的项目结构?
编辑: 修正了一个错字.
在获取输入密码后,我有一个运行标准-task的Ant脚本:
<input message="Password:" addproperty="password">
<handler classname="org.apache.tools.ant.input.SecureInputHandler" />
</input>
<exec executable="/bin/sh" input="${password}" failonerror="true">
<arg line='-c "myScript.sh"' />
</exec>
Run Code Online (Sandbox Code Playgroud)
脚本myScript.sh会提示用户输入密码,而且我的理解是从Ant文档中输入应该是中继输入到<exec>任务执行的任何内容,而是我得到(用于输入密码foobar)
[exec] Failed to open /usr/local/foobar
Run Code Online (Sandbox Code Playgroud)
然后是我的脚本中的堆栈跟踪抱怨密码不正确...所以显然我已经理解文档错了.有人知道如何处理Ant中外部脚本的提示输入吗?
我无法让AspectJ在我的主项目中使用@configurable注释的类上执行加载时编织.没有设置字段,也没有触及任何设置器.
我不认为配置本身存在问题,因为我已经提取了配置并在较小的沙箱项目上对其进行了测试.只是为了它,我会把它包含在这个问题中.
所以,我想知道:
最后,无论我提取什么代码(请原谅混淆):
从配置XML:
<context:annotation-config />
<context:spring-configured />
<context:component-scan base-package="se.isydev" />
<context:component-scan base-package="se.istools" />
<aop:aspectj-autoproxy />
<context:load-time-weaver aspectj-weaving="on" />
<context:property-placeholder location="classpath:settings.properties" />
(...)
<bean class="com.company.ClassToBeWeaved"
scope="prototype">
<property name="injectedBean" ref="injectedBean" />
</bean>
Run Code Online (Sandbox Code Playgroud)
班级本身:
@Configurable
public class ClassToBeWeaved {
private InjectedBean injectedBean;
@Required
public void setInjectedBean() { ... }
}
Run Code Online (Sandbox Code Playgroud)
编辑:
好吧,事实证明它由于循环依赖而无法正常工作.哦,亲爱的,我喜欢处理遗留代码.不过,我原来的问题仍然存在.
由于各种原因,我的项目只能作为完成和打包的JAR运行(在程序集中会发生一些神奇的事情),所以我将它作为Eclipse中的外部工具运行.
我缺少的是调试功能.有没有办法在Eclipse中以调试模式运行外部工具?
我正处于需要创建缓存以存储需要从数据库更新的某些值的情况.由于这个缓存需要是单一的,因此某种单例实现似乎是合适的.
问题是这个缓存还需要通过EJB访问数据库,由于缓存存在于上下文之外,因此无法注入该数据库(是的,我期待EJB3.1中的@singleton注释).
显而易见的解决方案是将EJB作为参数传递到缓存中,但是在上下文之外传递EJB会感觉不对,但我不能说为什么.是接受的做法吗?
我有一个方法,check它有两个哈希映射作为参数.这些地图的键是a String,值是String或Arraylist.
哪个是更好的解决方案:
public static boolean check(HashMap<String, ?> map1, HashMap<String, ?> map2) {
for ( entry <String, ? > entry : map1.entryset()) {
...
}
}
Run Code Online (Sandbox Code Playgroud)
要么
public static <V> boolean check(HashMap<String, V> map1, HashMap<String, V> map2) {
for ( entry <String, V > entry : map1.entryset()) {
...
}
}
Run Code Online (Sandbox Code Playgroud)
为什么?
您是否还可以向我提供有关这两种解决方案之间差异的更多信息?