我在一个Linux机器上安装了Intellij IDEA社区,需要使用经过身份验证的代理来访问Internet.我在包装盒上有一个系统范围的代理,我在〜/ .m2/settings.xml中配置了代理.当我从命令行运行时,Maven正确使用代理.
我在Intellij中配置了相同的代理,它为我提供了正确的插件列表.但是当我尝试使用Intellij与Maven存储库同步时,我会继续这样做:
[WARNING] Unable to get resource 'org.codehaus.mojo:hibernate3-maven-plugin:pom:2.2'
from repository restlet (http://maven.restlet.org): Authorization failed: Not
authorized by proxy.
Run Code Online (Sandbox Code Playgroud)
我去了Settings-> Maven并将代理信息作为属性输入,但是没有用.我可以通过查看Intellij正在阅读我的〜./ m2/settings.xml的那些设置来查看,因为它知道我的本地仓库在哪里(它在非标准位置).
任何人都知道如何让这个工作?
我用谷歌搜索了这个似乎没有人有答案,但似乎这样的基本事情应该是可能的.
我有以下项目结构:
parent
---sub-project1
---sub-project2
Run Code Online (Sandbox Code Playgroud)
sub-project2需要将sub-project1作为依赖项.
所以我在sub-project2的pom中有这个:
<dependencies>
<dependency>
<artifactId>sub-project1</artifactId>
<groupId>mygroup</groupId>
<version>1.0-SNAPSHOT</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
....
当我这样做时,Maven尝试下载sub-project1.jar文件,该文件不存在,因为它还没有为repo做好准备.
我试图<scope>import</scope>在依赖中添加一个,但这也不起作用 - 结果相同.
那么在构建子项目2时,我需要做些什么才能让Maven查看子项目1?
编辑这里有一些pom片段:
家长:
<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>
<prerequisites>
<maven>2.0.9</maven>
</prerequisites>
<modules>
<module>sub-project1</module>
<module>sub-project2</module>
</modules>
....
Run Code Online (Sandbox Code Playgroud)
子PROJECT1:
<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">
<parent>
<artifactId>parent</artifactId>
<groupId>mygroup</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sub-project1</artifactId>
....
Run Code Online (Sandbox Code Playgroud)
分项目2:
<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">
<parent>
<artifactId>parent</artifactId>
<groupId>mygroup</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sub-project1</artifactId>
<dependencies>
....
<dependency>
<artifactId>sub-project2</artifactId>
<groupId>mygroup</groupId>
<version>1.0-SNAPSHOT</version>
<scope>import</scope>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
我mvn clean install 上父母时得到的错误是:
[ERROR] …Run Code Online (Sandbox Code Playgroud) 我知道这很傻,但出于某种原因,Jython拒绝找到javax.swing.我正在使用Java 1.6.0_11.这是我的初创脚本:
@echo off
"%JAVA_HOME%\bin\java" -Xmx1024M -classpath ".;c:\Projects\Jython2.5.1\jython.jar" org.python.util.jython
Run Code Online (Sandbox Code Playgroud)
我的输出看起来像:
Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_10
Type "help", "copyright", "credits" or "license" for more information.
>>> import javax.swing
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named swing
>>> import javax
>>> dir(javax)
['__name__']
>>>
Run Code Online (Sandbox Code Playgroud) 在Logback的文档中,他们将JMX信息放入XML文件看起来很简单:
http://logback.qos.ch/manual/jmxConfig.html
但他们所有的例子都使用他们的XML配置,我想使用Groovy.在他们的Groovy DSL文档中没有提到JMX Configurator:
http://logback.qos.ch/manual/groovy.html
所以我将XML中的第一个JMX/XML示例复制到Groovy转换器.
XML:
<configuration>
<jmxConfigurator />
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%date [%thread] %-5level %logger{25} - %msg%n</Pattern>
</layout>
</appender>
<root level="debug">
<appender-ref ref="console" />
</root>
</configuration>
Run Code Online (Sandbox Code Playgroud)
翻译者:
http://logback.qos.ch/translator/asGroovy.html
结果如下:
import ch.qos.logback.classic.PatternLayout
import ch.qos.logback.core.ConsoleAppender
import static ch.qos.logback.classic.Level.DEBUG
appender("console", ConsoleAppender) {
layout(PatternLayout) {
pattern = "%date [%thread] %-5level %logger{25} - %msg%n"
}
}
root(DEBUG, ["console"])
Run Code Online (Sandbox Code Playgroud)
它没有对JMX做任何事 - 只需放入控制台appender.
有什么想法我需要做什么?
这是我们的场景:
开发人员A检查包含新文件文件的更改.开发人员B进行了更新,突然间,因为文件丢失而导致内容中断.开发人员B尝试另一次更新,没有任何内容被提取,所以他打电话给开发人员A.开发人员A说:"嘿,我检查了他们,你是盲人吗?" 只有当开发人员B使用TortiseSVN Repo浏览器时,他才会看到,确实有新文件可用.修复是'在TortiseSVN Repo Browser中将项目更新到修订版.即使开发人员B通过资源管理器中的TortoiseSVN或Eclipse中的Subversive客户端进行更新,他也无法看到新文件.我们也无法通过Cygwin中的SVN命令行客户端看到该文件.
它不会一直发生,我们似乎无法随意重现它.但是当它发生时,它非常烦人.
我想通过JMS主题分发我的EhCache.这在EhCache的网站上有记载
我正在使用:
我的Spring配置如下所示:
Run Code Online (Sandbox Code Playgroud)<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> </bean> <bean id="cacheProvider" class="org.springmodules.cache.provider.ehcache.EhCacheFacade"> <property name="cacheManager" ref="cacheManager" /> </bean> <ehcache:proxy id="pocDaoCache" refId="pocDao"> <ehcache:caching methodName="fetch" cacheName="pocCache" /> </ehcache:proxy>
而且,在pre-JMS配置之前,我的ehcache.xml看起来像这样:
Run Code Online (Sandbox Code Playgroud)<diskStore path="c:/projects/cache/demo" /> <defaultCache maxElementsInMemory="50" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" /> <cache name="pocCache" maxElementsInMemory="10000" maxElementsOnDisk="1000" eternal="false" overflowToDisk="true" diskSpoolBufferSizeMB="20" timeToIdleSeconds="300" timeToLiveSeconds="600" memoryStoreEvictionPolicy="LFU" / >
这很好用.所以我添加了我的主题信息:
Run Code Online (Sandbox Code Playgroud)<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jms.JMSCacheManagerPeerProviderFactory" properties="initialContextFactoryName=JmsInitialContextFactory, userName=myuser,password=mypass, providerURL=tcp://jmsdev1-jndi,tcp://jmsdev2-jndi topicConnectionFactoryBindingName=TCF-00, topicBindingName=MyTopiceName" propertySeparator="," />
当我得到一个应用程序上下文时,我得到一个NullPointer.这是堆栈跟踪:
Run Code Online (Sandbox Code Playgroud)org.springframework.beans.factory.BeanCreationException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in class path resource [cache-context.xml]: Invocation of init …
我是Wicket的新手,但谷歌搜索这个问题并没有给我任何有意义的东西.所以我希望有人可以提供帮助.
我有一个扩展Form的SiteChoice对象,以及一个扩展DropDownChoice的SiteList对象.我的SiteChoice类看起来像:
public class SiteChoice extends Form {
public SiteChoice(String id) {
super(id);
addSiteDropDown();
}
private void addSiteDropDown() {
ArrayList<DomainObj> siteList = new ArrayList<DomainObj>();
// add objects to siteList
ChoiceRenderer choiceRenderer = new ChoiceRenderer<DomainObj>("name", "URL");
this.add(new SiteList("siteid",siteList,choiceRenderer));
}
}
Run Code Online (Sandbox Code Playgroud)
然后我只是将我的SiteChoice对象添加到我的Page对象中:
SiteChoice form = new SiteChoice("testform");
add(form);
Run Code Online (Sandbox Code Playgroud)
我的Wicket模板有:
当我调出页面时,它呈现正常 - 下拉列表被正确呈现.当我点击提交时,我收到了这个奇怪的错误:
WicketMessage: Method onFormSubmitted of interface
org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component
[MarkupContainer [Component id = fittest]] threw an exception
Root cause:
java.lang.IllegalStateException: Attempt to set model object on null
model of component: …Run Code Online (Sandbox Code Playgroud) 我有两个Spring代理设置:
<bean id="simpleBean" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<ref local="simpleBeanTarget"/>
</property>
<property name="interceptorNames">
<list>
<value>cacheInterceptor</value>
</list>
</property>
</bean>
<bean id="springDao" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="springDaoTarget"/>
<property name="interceptorNames">
<list>
<value>daoInterceptor</value>
</list>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
simpleBean工作正常 - springDao没有.
SpringDao类看起来像:
public class SpringDao extends JdbcDaoSupport {
private SimpleJdbcTemplate simpleJdbcTemplate;
public SimpleJdbcTemplate getSimpleJdbcTemplate() {
if (simpleJdbcTemplate==null) {
simpleJdbcTemplate= new SimpleJdbcTemplate(getDataSource());
}
return simpleJdbcTemplate;
}
...
Run Code Online (Sandbox Code Playgroud)
我的单元测试自动装配如下:
@Autowired
@Qualifier("springDao")
protected SpringDao springDao;
Run Code Online (Sandbox Code Playgroud)
并且第一个指示错误的是我收到此错误:
无法自动装配领域:...嵌套异常是java.lang.IllegalArgumentException
如果我注释掉@Qualifier注释并再次运行我的单元测试,我会得到:
没有类型的唯一bean ...期望的单个匹配bean但找到2:[springDaoTarget,springDao]
这就是我的预期.
所以我改变了我的自动装配
@Autowired
@Qualifier("springDaoTarget")
protected SpringCustomerCapacityDao springDao;
Run Code Online (Sandbox Code Playgroud)
并在我的单元测试中添加了以下内容:
Object proxy = applicationContext.getBean("springDao"); …Run Code Online (Sandbox Code Playgroud) Matplotlib新手在这里。
我有以下代码:
from pylab import figure, show
import numpy
fig = figure()
ax = fig.add_subplot(111)
plot_data=[1.7,1.7,1.7,1.54,1.52]
xdata = range(len(plot_data))
labels = ["2009-June","2009-Dec","2010-June","2010-Dec","2011-June"]
ax.plot(xdata,plot_data,"b-")
ax.set_xticks(range(len(labels)))
ax.set_xticklabels(labels)
ax.set_yticks([1.4,1.6,1.8])
fig.canvas.draw()
show()
Run Code Online (Sandbox Code Playgroud)
运行该代码时,生成的图表将带有第一个刻度标签(2009年6月)和原点。我如何才能使图形移动以使其更具可读性?我试图放入虚拟数据,但随后Matplotlib(正确)将其视为数据。
我继承了一堆不同质量的代码,我正在修复一堆错误的东西.它做的一件事是有一个表格输入表,其中一个使用jquery-ui Datepicker.还有一个按钮可在表格底部创建一个新行.新行的Datepicker永远不会出现.
我已经在SO上列出了这个问题几次,但这些解决方案都没有奏效.我正在把我现在拥有的东西拿出来.我的小伙子在:
http://jsfiddle.net/squarepegsys/G8WEC/2/
我代码的内容在这里:
tr.find(".datepicker").on("focusin",function() {
console.log("got focus");
$(this).datepicker();
});
Run Code Online (Sandbox Code Playgroud)
在on("focusin"...)行中,我看到控制台上的"焦点",但从未看到日期选择器出现.