我已经更新到最新版本的ADT插件,我遇到了这个问题,解决了更新m2e-android eclipse插件.现在,我可以通过控制台编译我的项目,但不能用eclipse编译.这是pom.xmleclipse中文件引发的异常:
dependency=[com.actionbarsherlock:library:apklib:4.1.0:compile] not found in workspace
在以前的ADT/m2e-android版本中,我能够毫无问题地构建控制台和eclipse.
有谁知道如何解决这个问题?也许我的pom.xml错了?
谢谢你的时间.
目前使用:
pom.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<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>com.jelies</groupId>
<artifactId>my-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>apk</packaging>
<dependencies>
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>4.1_r2</version>
<scope>provided</scope>
</dependency>
<!-- some unrelated dependencies -->
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>library</artifactId>
<version>4.1.0</version>
<type>apklib</type>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version> …Run Code Online (Sandbox Code Playgroud) 我正在使用Spring + Spring Data JPA和Hibernate,我需要执行一些大而昂贵的数据库操作.
我如何使用a StatelessSession来执行这些操作?
我的gae + spring + maven项目完美无缺.但我无法使用eclipse使其工作.
当我使用来自eclipse的GAE(使用Google插件,运行方式> Web应用程序)运行我的项目时,似乎我的pom.xml中声明的spring-web依赖关系正从WEB-INF/lib中消失.所以没有spring-web,这是个例外:
Could not instantiate listener org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
Run Code Online (Sandbox Code Playgroud)
(这里有完整的GAE堆栈跟踪)
从控制台,运行mvn clean package gae:run,应用程序就像一个魅力和弹簧网络按预期放在WEB-INF/lib目录下.
刚刚在BitBucket上发布我的测试项目:https://bitbucket.org/jelies/gae-spring-maven
知道为什么在从eclipse启动webapp时没有将spring-web发布到WEB-INF/lib?
使用:
更新: 使用spring版本3.1.4.RELEASE时,spring-web依赖关系正在发布到WEB-INF/lib.任何3.2.X版本都不会发生这种情况.
有没有人知道需要添加到Proguard for Google Analytics的keep语句?
我现在有这条线但由于某种原因没有报道......
# google analytics, uncomment if using:
-keep class com.google.android.apps.analytics.PipelinedRequester$Callbacks
Run Code Online (Sandbox Code Playgroud) 我试图找到有关如何使用Spring Data仅选择实体的某些字段的信息(我正在使用JPA).我只想选择一个实体的特定信息,存储库接口为您提供了返回WHOLE实体信息的方法!有时我只需要一个实体的2或3个字段并返回20,30,... 100 ..字段可能有点矫枉过正.
我会使用Hibernate Criteria Projections,甚至是JPA"SELECT NEW ...."查询来实现这种功能.不知道Spring Data是否可行.
谢谢.
我正在尝试使用robolectric测试ORMLite DAO,但数据库行为与从我的Android应用程序中使用它时的行为不同.我的DAO在Android应用程序上运行得非常好.
阅读robolectric阴影和调试代码,我遇到了ShadowSQLiteOpenHelper(这里的代码).
有谁知道这个暗影是否足以测试ormlite daos?或者我必须创建自己的影子才能实现这一目标?这里有任何线索/提示/建议/示例吗?
提前致谢.
额外信息:
测试方法:
@Test
public void basicTest() throws SQLException {
assertNotNull(randomStringResource); // Injection of an android resource: OK
assertThat(randomStringResource, equalTo("Event")); // With correct value: OK
assertNotNull(eventDao); // Dao injection: OK
assertThat(eventDao.countOf(), equalTo(0L)); // Table empty: OK
Event e1 = new Event("e1", new Date());
eventDao.create(e1);
assertNotNull(e1.getId()); // ID generated by OrmLite: OK
assertThat(eventDao.countOf(), equalTo(1L)); // Table not empty: OK
assertThat("e1", equalTo(eventDao.queryForId(e1.getId()).getName())); // Query for inserted event: Throws exception
}
Run Code Online (Sandbox Code Playgroud)
运行此测试时遇到的一些问题:
在Spring MVC 3.1中我可以做到:
@RequestMapping(value = "{id}/edit", method = RequestMethod.POST)
public String update(Category category, @PathVariable Integer id,
@RequestParam("childrenOrder") int[] childrenOrder,
RedirectAttributes redirectAttributes) {
if (!id.equals(category.getCategoryId())) throw new IllegalArgumentException("Attempting to update the wrong category");
categoryMapper.updateByPrimaryKey(category);
redirectAttributes.addFlashAttribute("flashSuccessMsg", "Update Successful"); //ADD FLASH MESSAGE
return "redirect:/admin/categories.html";
}
Run Code Online (Sandbox Code Playgroud)
然后在视图中显示flash消息:
<p>${flashSuccessMsg}</p>
Run Code Online (Sandbox Code Playgroud)
但我宁愿有一个flash消息列表,然后在视图中迭代它.
这可能吗?
如果我这样做:redirectAttributes.addFlashAttribute("Update Successful");
即我没有命名flash消息,我该如何在视图中检索它?
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving
up static resources in the ${webappRoot}/resources/ directory -->
<resources mapping="/resources/**" location="/resources/" />
<bean class="org.springframework.web.multipart.commons.CommonsMultipartResolver"
id="multipartResolver"> <property name="maxUploadSize" value="500000" />
</bean>
Run Code Online (Sandbox Code Playgroud)
有我的context.xml文件但是当我包含multipartResolver配置时,我收到以下错误:
"cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'bean'.".
Run Code Online (Sandbox Code Playgroud)
请帮助我,我是春天新手.
这是我的实用程序java文件:
public class HibernateUtil {
private static SessionFactory sessionFactory = null;
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
public static void setSessionFactory(SessionFactory sessionFactory) {
HibernateUtil.sessionFactory = sessionFactory;
}
}
Run Code Online (Sandbox Code Playgroud)
为spring-servlet.xml:
<bean id="HibernateUtil" class="com.chrysler.Utilities.HibernateUtil">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>/WEB-INF/hibernate.cfg.xml</value>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
当我运行这个,我得到以下错误:
org.springframework.beans.NotWritablePropertyException:bean类的无效属性'sessionFactory'[com.chrysler.Utilities.HibernateUtil]:Bean属性'sessionFactory'不可写或具有无效的setter方法.setter的参数类型是否与getter的返回类型匹配?