小编Jea*_*evy的帖子

使用默认值询问maven原型属性

我正在整理一个maven原型,它有一堆自定义属性,用于过滤各种原型资源.我在archetype-metadata.xml中指定了默认值,例如

<requiredProperties>
  <requiredProperty key="application-name">
    <defaultValue>Some Application</defaultValue>
  </requiredProperty>>  
</requiredProperties>
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试使用原型创建项目时,它不允许我以交互方式更改这些项目.例如,它要求默认版本如下

Define value for property 'version': 1.0-SNAPSHOT: 
Run Code Online (Sandbox Code Playgroud)

允许输入版本,但如果没有输入则默认为1.0-SNAPSHOT.对于我的自定义属性,它仅在创建新项目之前显示它们

[INFO] Using property: application-name = Some Application
Run Code Online (Sandbox Code Playgroud)

如果我省略了archetype-metadata.xml中的默认值,那么它会提示我输入一个值,但是没有默认值.

是否可以提供默认值并仍然提示?

maven-2 maven-archetype

15
推荐指数
3
解决办法
7729
查看次数

缺少Maven插件Jetty

我无法理解这个http://hrycan.com/2012/03/28/primefaces-lazy-loading-datatable-for-jsf2/

它说我应该跑

mvn jetty:run
Run Code Online (Sandbox Code Playgroud)

但我继续遇到这个错误.

org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found
for prefix 'jetty' in the current project and in the plugin groups [org.apache.m
aven.plugins, org.codehaus.mojo] available from the repositories [local (C:\MyRepo), central (http://repo1.maven.org/maven2)]
        at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.r
Run Code Online (Sandbox Code Playgroud)

我在这里使用了Maven 3.

有什么想法吗?

加:

从链接中,它已经存在于pom.xml中

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>7.5.1.v20110908</version>
    <dependencies>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.version}</version>
        </dependency>
    </dependencies>
</plugin>
Run Code Online (Sandbox Code Playgroud)

maven-plugin maven-3

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

我可以使用buildnumber-maven-plugin设置项目版本吗?

我正在尝试将svn.revision添加到项目版本作为内部版本号,但似乎无法这样做.我的jar有正确的名称durin打包,但它安装在我的本地存储库中,就好像$ {buildNumber}在设置版本时未定义.

我得到foo-1.0.0-SNAPSHOT- $ {buildNumber}而不是foo-1.0.0-SNAPSHOT- 304

知道我做错了什么或者在项目版本中添加修改是个坏主意吗?谢谢您的帮助.

<project>
  ...
  <version>1.0.0-${release.identifier}-${buildNumber}</version>
  <properties>
    <release.identifier>SNAPSHOT</release.identifier>
  </properties>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>useLastCommittedRevision</id>
            <goals>
              <goal>create</goal>
            </goals>
            <configuration>
              <useLastCommittedRevision>true</useLastCommittedRevision>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  ...
</project>
Run Code Online (Sandbox Code Playgroud)

maven-2 maven-plugin buildnumber-maven-plugin

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

将额外属性传递给maven原型:generate

我为自定义项目设置创建了一个Maven原型,它运行得非常好,但我想知道是否可以传递额外的参数以便我可以做一些更有趣的模板.我试过类似的东西

mvn archetype:generate -DarchetypeCatalog=local -DdbHost=localhost
Run Code Online (Sandbox Code Playgroud)

并把

...
<option name="db.host.config.option" value="${dbHost}" />
...
Run Code Online (Sandbox Code Playgroud)

在我的模板中,但似乎不起作用.有没有办法用原型做到这一点?

maven-2 maven-archetype

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

如何正确执行git merge/pull:你还没有完成你的合并(MERGE_HEAD存在)

我是Git的新手,无法理解如何使用Git.我一直在使用CVS,因此需要为Git学习一些学习曲线.这就是我所尝试的一切

现在我只更改了两个文件PromoServiceImpl.java和build.sql.但是合并有问题从"产品"分支改变了.

您看到的剩余文件(如ApiServiceImpl.java等)是来自其他用户的更改,但我不确定此处的表示是否表明我已更改它们.问题是它在早期的pull命令中合并了,现在它希望我提交它们?

无论我遵循什么命令流(即使在谷歌搜索之后),我都会看到以下错误:

您尚未完成合并(MERGE_HEAD存在)请在合并之前提交您的更改.

这是我遵循和输出的命令序列(试图通过插入新行供每个人阅读来使其漂亮).即使在重新从存储库中进行更改之后,这个错误也会回来,所以我确信我做错了而不是git的一些问题.

kamal@kamal-Lenovo-G470:~/git/TryGit$ gs
# On branch product
# Your branch is ahead of 'origin/product' by 1 commit.
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   TryGitServices/src/main/java/com/TryGit/services/promo/impl/PromoServiceImpl.java
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   Adding
no changes added to commit …
Run Code Online (Sandbox Code Playgroud)

git merge git-pull

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

org.apache.maven.BuildFailureException:未提供任何SCM URL来执行发布

我正在使用maven 2.2.1并成功运行:

mvn -B release:clean release:prepare
Run Code Online (Sandbox Code Playgroud)

但是当我运行时,收到错误消息" 没有提供SCM URL来执行发布 ":

mvn release:perform
Run Code Online (Sandbox Code Playgroud)

我的pom.xml正确定义了scm标记:

<scm>
    <url>file:///C:/tmp/svnrepo/myproj/trunk</url>        
    <connection>scm:svn:file:///C:/tmp/svnrepo/myproj/trunk</connection>
    <developerConnection>scm:svn:file:///C:/tmp/svnrepo/myproj/trunk</developerConnection>        
</scm>
Run Code Online (Sandbox Code Playgroud)

maven maven-release-plugin

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

没有用于文件的嵌入式样式表指令:使用logback的错误

我有以下logback.xml配置:

<configuration>
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <!-- encoders are assigned the type
         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
    <encoder>
      <pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern>
    </encoder>
  </appender>

    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>logFile.log</file>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <!-- daily rollover -->
      <fileNamePattern>logFile.%d{yyyy-MM-dd}.log</fileNamePattern>

      <!-- keep 30 days' worth of history -->
      <maxHistory>30</maxHistory>
    </rollingPolicy>

    <encoder>
      <pattern>%-4relative [%thread] %highlight(%-5level) %cyan(%logger{35}) - %msg%n</pattern>
    </encoder>
  </appender> 

  <root level="DEBUG">
    <appender-ref ref="STDOUT" />
    <appender-ref ref="FILE" /> 

  </root>
</configuration>
Run Code Online (Sandbox Code Playgroud)

如果我在eclipse(juno)中编辑配置文件,我会收到以下错误:

11:02:54,114 INFO  [main] Main  - javax.xml.transform.TransformerFactory=null
11:02:54,115 INFO  [main] Main  - java.endorsed.dirs=C:\Program Files\Java\jre7\lib\endorsed
11:02:54,117 …
Run Code Online (Sandbox Code Playgroud)

eclipse logback

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

一个Android项目的maven archetype

maven原型中列出了以下选项:generate

19: remote -> android-quickstart (-)
20: remote -> android-release (-)
21: remote -> android-with-test (-)
Run Code Online (Sandbox Code Playgroud)

http://code.google.com/p/maven-android-plugin/上还有一个插件可用

什么是正确的原型/插件用于Android 3.1应用程序开发?

android maven maven-archetype

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

使用maven android archetype和eclipse

我试图使用以下原型. https://github.com/akquinet/android-archetypes/wiki/Android-release-archetype

我可以按照页面上的说明(使用终端)
我想知道,我如何在Eclipse中执行此操作?是否有一种命令行界面我可以输入所需的命令?即

   mvn archetype:generate \
  -DarchetypeArtifactId=android-release \
  -DarchetypeGroupId=de.akquinet.android.archetypes \
  -DarchetypeVersion=1.0.5 \
  -DgroupId=com.foo.bar \
  -DartifactId=my-android-project \
  -Dpackage=com.foo.bar.android
Run Code Online (Sandbox Code Playgroud)

谢谢

eclipse android maven maven-archetype

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

在Maven中构建EAR文件时出错

我正面临以下问题:

无法在项目UserAdminEAR上执行目标org.apache.maven.plugins:maven-ear-plugin:2.7:generate-application-xml(default-generate-application-xml):Artifact [war:com.syril.administration:UserAdmin]不是项目的依赖项. - > [帮助1]

这种错误的解决方案是什么?

我的pom.xml是

<modelVersion>4.0.0</modelVersion>
<groupId>UserAdminEAR</groupId>
<artifactId>UserAdminEAR</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>UserAdmin</name>
<packaging>ear</packaging>
<dependencies>
    <dependency>
        <groupId>com.syril.dao</groupId>
        <artifactId>dataAccess</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>com.syril.service</groupId>
        <artifactId>UserAdminService</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>war</type>
    </dependency>

</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <defaultLibBundleDir>lib</defaultLibBundleDir>
                <modules>
                    <jarModule></jarModule>
                    <javaModule>
                        <groupId>com.syril.dao</groupId>
                        <artifactId>dataAccess</artifactId>
                        <includeInApplicationXml>true</includeInApplicationXml>
                    </javaModule>
                    <webModule>
                        <groupId>com.syril.service</groupId>
                        <artifactId>UserAdminSL</artifactId>
                        <contextRoot>/UserAdminSL</contextRoot>
                    </webModule>
                </modules>
            </configuration>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

maven maven-ear-plugin

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