我正在申请转让。我是初学者。我通过修改我老师给我的一个例子来完成这项任务。我尝试使用maven通过命令行编译应用程序。发生了构建错误。
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\dell>f:
F:\>cd \COIT13235-s0234380-ass1\assignment 1
F:\COIT13235-s0234380-ass1\assignment 1> mvn compile
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building folder_a
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[WARNING] POM for 'commons-cli:commons-cli:pom:1.0:runtime' is invalid.
Its dependencies (if any) will NOT be available to the current build.
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (GB18030 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 1 resource
Downloading: http://repo1.maven.org/maven2/org/eclipse/persistence/javax.persist
ence/${derby-version}/javax.persistence-${derby-version}.pom
[INFO] Unable to find resource 'org.eclipse.persistence:javax.persistence:pom:${
derby-version}' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/eclipse/persistence/eclipselink/$
{derby-version}/eclipselink-${derby-version}.pom
[INFO] Unable to find resource 'org.eclipse.persistence:eclipselink:pom:${derby-
version}' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/apache/derby/derbyclient/${derby-
version}/derbyclient-${derby-version}.pom
[INFO] Unable to find resource 'org.apache.derby:derbyclient:pom:${derby-version
}' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/apache/derby/derby/${derby-versio
n}/derby-${derby-version}.pom
[INFO] Unable to find resource 'org.apache.derby:derby:pom:${derby-version}' in
repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/eclipse/persistence/javax.persist
ence/${derby-version}/javax.persistence-${derby-version}.jar
Downloading: http://repo1.maven.org/maven2/org/apache/derby/derbyclient/${derby-
version}/derbyclient-${derby-version}.jar
[INFO] Unable to find resource 'org.eclipse.persistence:javax.persistence:jar:${
derby-version}' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/eclipse/persistence/eclipselink/$
{derby-version}/eclipselink-${derby-version}.jar
[INFO] Unable to find resource 'org.apache.derby:derbyclient:jar:${derby-version
}' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/apache/derby/derby/${derby-versio
n}/derby-${derby-version}.jar
[INFO] Unable to find resource 'org.eclipse.persistence:eclipselink:jar:${derby-
version}' in repository central (http://repo1.maven.org/maven2)
[INFO] Unable to find resource 'org.apache.derby:derby:jar:${derby-version}' in
repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) org.eclipse.persistence:javax.persistence:jar:${derby-version}
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.eclipse.persistence -DartifactId=ja
vax.persistence -Dversion=${derby-version} -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.eclipse.persistence -DartifactId=java
x.persistence -Dversion=${derby-version} -Dpackaging=jar -Dfile=/path/to/file -D
url=[url] -DrepositoryId=[id]
Path to dependency:
1) task1:folders:jar:2.0
2) org.eclipse.persistence:javax.persistence:jar:${derby-version}
2) org.apache.derby:derbyclient:jar:${derby-version}
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.apache.derby -DartifactId=derbyclie
nt -Dversion=${derby-version} -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.apache.derby -DartifactId=derbyclient
-Dversion=${derby-version} -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -Dr
epositoryId=[id]
Path to dependency:
1) task1:folders:jar:2.0
2) org.apache.derby:derbyclient:jar:${derby-version}
3) org.eclipse.persistence:eclipselink:jar:${derby-version}
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.eclipse.persistence -DartifactId=ec
lipselink -Dversion=${derby-version} -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.eclipse.persistence -DartifactId=ecli
pselink -Dversion=${derby-version} -Dpackaging=jar -Dfile=/path/to/file -Durl=[u
rl] -DrepositoryId=[id]
Path to dependency:
1) task1:folders:jar:2.0
2) org.eclipse.persistence:eclipselink:jar:${derby-version}
4) org.apache.derby:derby:jar:${derby-version}
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.apache.derby -DartifactId=derby -Dv
ersion=${derby-version} -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.apache.derby -DartifactId=derby -Dver
sion=${derby-version} -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -Dreposit
oryId=[id]
Path to dependency:
1) task1:folders:jar:2.0
2) org.apache.derby:derby:jar:${derby-version}
----------
4 required artifacts are missing.
for artifact:
task1:folders:jar:2.0
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Aug 01 16:07:06 EST 2013
[INFO] Final Memory: 8M/75M
[INFO] ------------------------------------------------------------------------
'cmd' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
F:\COIT13235-s0234380-ass1\assignment 1>
这是我的pom.xml文件的一部分。
<modelVersion>4.0.0</modelVersion>
<groupId>task1</groupId>
<artifactId>folders</artifactId>
<packaging>jar</packaging>
<version>2.0</version>
<name>folder_a</name>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>${derby-version}</version><!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>${derby-version}</version><!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>${derby-version}</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>${derby-version}</version><!--<scope>test</scope>-->
</dependency>
</dependencies>
答案 0 :(得分:3)
看起来你错过了${derby-version}
属性。
您应该在POM中将其定义为
<properties>
<derby-version>YOUR_DERBY_VERSION_IDENTIFIER_HERE</derby-version>
</properties>
答案 1 :(得分:0)
从这一行很明显
mvn install:install-file -DgroupId=org.eclipse.persistence
-DartifactId=eclipselink -Dversion=${derby-version} -Dpackaging=jar
-Dfile=/path/to/file
maven无法在构建期间解析derby-version值。
因此,要么在ramaz建议的pom文件中声明derby-version变量,要么将变量替换为所有依赖项中的实际值(不推荐)。