小编mem*_*und的帖子

Android与maven?Apk未知

无法让Android与maven一起使用.可能是什么问题(从maven quickstart archetype生成):

<?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>asd</groupId>
    <artifactId>asd</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>asd</name>

    <properties>
        <platform.version>4.0.3</platform.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>${platform.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                    <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                    <resourceDirectory>${project.basedir}/res</resourceDirectory>
                    <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                    <sdk>
                        <platform>15</platform>
                    </sdk>
                    <emulator>
                        <avd>Android4</avd>
                    </emulator>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
Run Code Online (Sandbox Code Playgroud)

导致:

Project build error: Unknown packaging: apk
Run Code Online (Sandbox Code Playgroud)

+

Project build error: Unresolveable build extension: Plugin 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.2.0 or one of its …
Run Code Online (Sandbox Code Playgroud)

java android maven

12
推荐指数
3
解决办法
2万
查看次数

带有注释的Bean定义继承?

是否可以使用基于注释的配置(@Bean等)实现相同的bean继承?

<bean id="inheritedTestBean" abstract="true"
        class="org.springframework.beans.TestBean">
    <property name="name" value="parent"/>
    <property name="age" value="1"/>
</bean>

<bean id="inheritsWithDifferentClass"
        class="org.springframework.beans.DerivedTestBean"
        parent="inheritedTestBean" init-method="initialize">
    <property name="name" value="override"/>
    <!-- the age property value of 1 will be inherited from parent -->
</bean>
Run Code Online (Sandbox Code Playgroud)

http://docs.spring.io/spring/docs/4.1.0.BUILD-SNAPSHOT/spring-framework-reference/htmlsingle/#beans-child-bean-definitions

java spring

12
推荐指数
1
解决办法
5711
查看次数

如何将文件夹的所有文件加载到Spring中的资源列表?

我有一个文件夹,想要使用Spring和通配符将所有txt文件加载到列表中:

通过注释,我可以做以下事情:

@Value("classpath*:../../dir/*.txt")
private Resource[] files;
Run Code Online (Sandbox Code Playgroud)

但是如何以编程方式使用spring实现相同的目标呢?

java spring spring-batch

12
推荐指数
2
解决办法
2万
查看次数

如何在postgres中删除约束?

我在sql中有这个查询:

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id('[FK_states_list]') AND OBJECTPROPERTY(id, 'IsForeignKey') = 1)
ALTER TABLE [custom_table] DROP CONSTRAINT [FK_states_list] ;
Run Code Online (Sandbox Code Playgroud)

我如何在postgres中编写此查询?提前致谢

sql postgresql

12
推荐指数
1
解决办法
1万
查看次数

替换标签内的字符串?

我想替换某些标签内的内容,例如:

<p>this it to be replaced</p>
Run Code Online (Sandbox Code Playgroud)

我可以在这样的组之间提取内容,但我能否真正替换该组?

str = str.replaceAll("<p>([^<]*)</p>", "replacement");
Run Code Online (Sandbox Code Playgroud)

java regex

11
推荐指数
2
解决办法
1万
查看次数

什么违规类告诉我服务器启动?

我有jee7 web api作为依赖.我可以在tomcat应用程序上成功启动我的应用程序,但以下"违规类"语句告诉我什么?我必须采取任何行动吗?

Jan 13, 2014 5:47:47 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
Information: validateJarFile(C:\Users\me\Servers\apache-tomcat-7.0.50\wtpwebapps\app\WEB-INF\lib\el-api-2.2.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Jan 13, 2014 5:47:47 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
Information: validateJarFile(C:\Users\me\Servers\apache-tomcat-7.0.50\wtpwebapps\app\WEB-INF\lib\javaee-web-api-7.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Run Code Online (Sandbox Code Playgroud)

的pom.xml

    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

java tomcat

11
推荐指数
1
解决办法
4万
查看次数

如何将所有依赖项放在runnable jar的单独文件夹中?

我正在使用mvn package创建一个可运行的jar,其中包含所有依赖项,运行正常.但我更喜欢将所有外部依赖项打包在一个单独的文件夹中.那么我需要改变什么呢?

    <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4</version>
        <configuration>
            <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
            <archive>
                <manifest>
                    <mainClass>my.MainApp</mainClass>
                </manifest>
            </archive>
        </configuration>
        <executions>
            <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
            </execution>
        </executions>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

java maven

11
推荐指数
1
解决办法
3226
查看次数

如何为Spring Security创建类型安全的用户角色?

我想利用spring-securitywith ROLE_ADMINROLE_USER角色.

因此,我尝试创建一个类型安全的枚举类,但是@Secured注释需要一个常量String,这是我无法通过使用枚举类实现的.

我可以在以下代码中更改什么?

public enum UserRole {
    ADMIN("ROLE_ADMIN");

    private String role;

    public UserRole(String role) {  
        this.role = role;
    }
}

//error: The value for annotation attribute Secured.value must be a constant expression
@Secured(USerRole.ADMIN.value())
public class SecuredView {

}
Run Code Online (Sandbox Code Playgroud)

java enums spring-security

11
推荐指数
2
解决办法
5632
查看次数

如何在春季通过个人资料启用@Scheduled作业?

我怎样才能在特定的配置文件中启用预定作业?

伪代码:

@Scheduled(cron = "${job.cron}")
@Profile("prod")
public void runJob() {

}
Run Code Online (Sandbox Code Playgroud)

那可能吗?

java spring spring-boot

11
推荐指数
2
解决办法
5025
查看次数

如何增加JavaScript对象中的值?

var map = {};
map[key] = value;
Run Code Online (Sandbox Code Playgroud)

我怎么能够

  • 如果对象中尚不存在键,则赋值1
  • 如果存在,则将值增加1

我可以做得比:

if (map[key] == null) map[key] = 0;
map[key] = map[key]++;
Run Code Online (Sandbox Code Playgroud)

javascript

11
推荐指数
4
解决办法
2万
查看次数