嗨,我遇到了这个问题:我创建了pom.xml,现在我想在特定文件夹中导出一些依赖项。 pom.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of JEMMA - http://jemma.energy-home.org
(C) Copyright 2013 Telecom Italia (http://www.telecomitalia.it)
JEMMA is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) version 3
or later as published by the Free Software Foundation, which accompanies
this distribution and is available at http://www.gnu.org/licenses/lgpl.html
JEMMA is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License (LGPL) for more details.
-->
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.energy-home</groupId>
<artifactId>jemma</artifactId>
<packaging>pom</packaging>
<version>0.2</version>
<name>JEMMA</name>
<properties>
<main.dir>${project.basedir}</main.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--successfuttly moved to local repo -->
<org.eclipse.equinox.ds.version>1.1.1</org.eclipse.equinox.ds.version>
<org.eclipse.equinox.device.version>1.0.100</org.eclipse.equinox.device.version>
<org.eclipse.osgi.version>3.5.2</org.eclipse.osgi.version>
<org.eclipse.core.jobs.version>3.4.100</org.eclipse.core.jobs.version>
<org.eclipse.osgi.services.version>3.2.0</org.eclipse.osgi.services.version>
<org.eclipse.osgi.util.version>3.2.0</org.eclipse.osgi.util.version>
<org.apache.commons.logging.version>1.1.1</org.apache.commons.logging.version>
<org.eclipse.equinox.util.version>1.0.100</org.eclipse.equinox.util.version>
<org.eclipse.equinox.cm.version>1.0.100</org.eclipse.equinox.cm.version>
<org.eclipse.equinox.event.version>1.1.101</org.eclipse.equinox.event.version>
<org.apache.xerces.version>2.9.0</org.apache.xerces.version>
<org.apache.xml.resolver.version>1.2.0</org.apache.xml.resolver.version>
<org.apache.xml.serializer.version>2.7.1</org.apache.xml.serializer.version>
<javax.xml.version>1.3.4</javax.xml.version>
<org.eclipse.equinox.useradmin.version>1.1.100</org.eclipse.equinox.useradmin.version>
<org.eclipse.equinox.preferences.version>3.2.301</org.eclipse.equinox.preferences.version>
<org.eclipse.equinox.common.version>3.5.1</org.eclipse.equinox.common.version>
<org.apache.commons.codec.version>1.3.0</org.apache.commons.codec.version>
<jaxb-osgi.version>2.2.7</jaxb-osgi.version>
<jaxb-api-osgi.version>2.2.7</jaxb-api-osgi.version>
<stax-osgi.version>0.3.95</stax-osgi.version>
<javax.activation.version>1.1</javax.activation.version>
<org.apache.commons.httpclient.version>3.1.0</org.apache.commons.httpclient.version>
<org.apache.felix.bundlerepository.version>1.6.6</org.apache.felix.bundlerepository.version>
<javax.servlet.version>2.5.0</javax.servlet.version>
<org.eclipse.equinox.http.registry.version>1.0.200</org.eclipse.equinox.http.registry.version>
<org.eclipse.equinox.http.servlet.version>1.0.200</org.eclipse.equinox.http.servlet.version>
<org.eclipse.equinox.http.servletbridge.version>1.1.100</org.eclipse.equinox.http.servletbridge.version>
<org.mortbay.jetty.server.version>6.1.23</org.mortbay.jetty.server.version>
<org.mortbay.jetty.util.version>6.1.23</org.mortbay.jetty.util.version>
<org.eclipse.equinox.registry.version>3.4.100</org.eclipse.equinox.registry.version>
<org.apache.felix.webconsole.version>3.1.8</org.apache.felix.webconsole.version>
<org.apache.felix.webconsole.plugins.event.version>1.0.2</org.apache.felix.webconsole.plugins.event.version>
<org.apache.felix.webconsole.plugins.memoryusage.version>1.0.2</org.apache.felix.webconsole.plugins.memoryusage.version>
<org.apache.felix.webconsole.plugins.upnp.version>1.0.0</org.apache.felix.webconsole.plugins.upnp.version>
<org.apache.commons.io.version>1.4</org.apache.commons.io.version>
<org.apache.commons.fileupload.version>1.2.2</org.apache.commons.fileupload.version>
<org.json.simple.version>1.1</org.json.simple.version>
<org.json.version>1.0.0</org.json.version>
<org.restlet.version>2.1.6</org.restlet.version>
<org.restlet.ext.xml.version>2.1.6</org.restlet.ext.xml.version>
<!--<com.noelios.restlet.version>1.1</com.noelios.restlet.version>
<com.noelios.restlet.ext.net.version>1.1</com.noelios.restlet.ext.net.version>-->
<edu.emory.mathcs.backport.version>1.2.0</edu.emory.mathcs.backport.version>
<org.apache.felix.scr.version>1.6.0</org.apache.felix.scr.version>
<org.slf4j.version>1.7.7</org.slf4j.version>
<commons.jabsorb.version>1.3.1</commons.jabsorb.version>
<maven.license.plugin.version>2.5</maven.license.plugin.version>
<maven.clean.plugin.version>2.5</maven.clean.plugin.version>
<felix.bundle.plugin.version>2.3.7</felix.bundle.plugin.version>
<!-- Internal dependencies version properties -->
<org.energy-home.jemma.osgi.ah.hac.lib.version>3.1.4</org.energy-home.jemma.osgi.ah.hac.lib.version>
<org.energy-home.jemma.osgi.ah.hac.version>3.1.3</org.energy-home.jemma.osgi.ah.hac.version>
<org.energy-home.jemma.osgi.ah.felix.console.web.version>1.0.9</org.energy-home.jemma.osgi.ah.felix.console.web.version>
<org.energy-home.jemma.osgi.ah.m2m.device.version>1.2.15</org.energy-home.jemma.osgi.ah.m2m.device.version>
<org.energy-home.jemma.osgi.ah.hap.client.version>1.2.15</org.energy-home.jemma.osgi.ah.hap.client.version>
<org.energy-home.jemma.osgi.utils.version>1.0.6</org.energy-home.jemma.osgi.utils.version>
<org.energy-home.jemma.osgi.ah.energyathome.version>2.2.25</org.energy-home.jemma.osgi.ah.energyathome.version>
<org.energy-home.jemma.osgi.ah.adapter.http.version>2.0.2</org.energy-home.jemma.osgi.ah.adapter.http.version>
<org.energy-home.jemma.osgi.ah.configurator.version>1.0.7</org.energy-home.jemma.osgi.ah.configurator.version>
<org.energy-home.jemma.osgi.device.zgd.version>1.1.15</org.energy-home.jemma.osgi.device.zgd.version>
<!--<org.energy-home.jemma.osgi.zgd.version>1.4.1</org.energy-home.jemma.osgi.zgd.version>-->
<org.energy-home.jemma.osgi.ah.zigbee.version>2.1.26</org.energy-home.jemma.osgi.ah.zigbee.version>
<org.energy-home.jemma.osgi.ah.webui.base.version>2.0.12</org.energy-home.jemma.osgi.ah.webui.base.version>
<org.energy-home.jemma.osgi.javagal.version>2.0.1</org.energy-home.jemma.osgi.javagal.version>
<org.ops4j.pax.logging.version>1.7.2</org.ops4j.pax.logging.version>
<org.slf4j.version>1.7.7</org.slf4j.version>
</properties>
<modules>
<module>jemma.launch</module>
<module>jemma.osgi.ah.hac.lib</module>
<module>jemma.osgi.ah.configurator</module>
<module>jemma.osgi.utils</module>
<module>jemma.osgi.ah.m2m.device</module>
<module>jemma.osgi.ah.hac</module>
<module>jemma.osgi.ah.hap.client</module>
<module>jemma.osgi.ah.upnp.energyathome</module>
<module>jemma.osgi.ah.io</module>
<module>jemma.osgi.javagal</module>
<module>jemma.osgi.javagal.rest</module>
<module>jemma.osgi.javagal.gui</module>
<module>jemma.osgi.javagal.json</module>
<module>jemma.osgi.ah.felix.console.web</module>
<module>jemma.osgi.ah.energyathome</module>
<module>jemma.osgi.ah.greenathome</module>
<module>jemma.osgi.ah.webui.base</module>
<module>jemma.osgi.ah.webui.energyathome</module>
<module>jemma.osgi.ah.webui.energyathome.demo</module>
<module>jemma.osgi.ah.adapter.http</module>
<module>jemma.osgi.ah.app</module>
<module>jemma.osgi.ah.zigbee</module>
<module>jemma.osgi.ah.zigbee.appliances.generic</module>
<module>jemma.osgi.ah.zigbee.appliances</module>
<!--<module>jemma.osgi.zgd</module>-->
<module>Distribution</module>
</modules>
<build>
<resources>
<resource>
<directory>.</directory>
<includes>
<include>OSGI-INF/**</include>
</includes>
</resource>
<resource>
<directory>./src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${felix.bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
<supportedProjectType>bundle</supportedProjectType>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-ClassPath>{maven-dependencies}</Bundle-ClassPath>
</instructions>
</configuration>
</plugin>
<!-- Deprecated, now assembly plugins is used to esport dependencies
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies-package</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
<configuration>
<outputDirectory>${main.dir}/libs</outputDirectory>
<excludeGroupIds>org.energy-home</excludeGroupIds>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>src/assemble/bin.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<!-- <plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>${maven.license.plugin.version}</version>
<configuration>
<header>header.txt</header>
<properties>
<owner>Telecom Italia</owner>
<year>2010</year>
</properties>
<useDefaultExcludes>true</useDefaultExcludes>
<strictCheck>true</strictCheck>
<includes>
<include>**/*.java</include>
<include>**/*.xml</include>-->
<!-- When add an header to a xml schema the jaxb cannot parses it
<include>**/*.xsd</include>
-->
<!-- </includes>
<excludes>
<exclude>**/README</exclude>
<exclude>src/test/resources/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>headers-add-and-check-package</id>
<phase>package</phase>
<goals>
<goal>format</goal>
<goal>check</goal>
</goals>
</execution>
<execution>
<id>headers-add-and-check-clean</id>
<phase>clean</phase>
<goals>
<goal>format</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven.clean.plugin.version}</version>
<!-- <configuration>
<filesets>
<fileset>
<directory>${project.basedir}</directory>
<includes>
<include>.settings/</include>
<include>.project</include>
<include>.classpath</include>
<include>bin/</include>
<include>META-INF/</include>
<include>.svn/**/*</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
<verbose>true</verbose>
</configuration> -->
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>localRepository</id>
<name>Local repository</name>
<url>http://130.192.85.149:8888/maven</url>
</repository>
<repository>
<id>maven-Jaxb</id>
<name>JAXB-NamespacePrefixMapper-Interfaces</name>
<url>http://mvnrepository.com/</url>
</repository>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.org</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.ds</artifactId>
<version>${org.eclipse.equinox.ds.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.util</artifactId>
<version>${org.eclipse.osgi.util.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>org.eclipse.core.jobs</artifactId>
<version>${org.eclipse.core.jobs.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.util</artifactId>
<version>${org.eclipse.equinox.util.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.device</artifactId>
<version>${org.eclipse.equinox.device.version}</version>
</dependency>
<dependency>
<groupId>jaxb-osgi</groupId>
<artifactId>jaxb-osgi</artifactId>
<version>${jaxb-osgi.version}</version>
<scope>compile</scope>
</dependency>
<!--For Logging-->
<dependency>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-service</artifactId>
<version>${org.ops4j.pax.logging.version}</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-api</artifactId>
<version>${org.ops4j.pax.logging.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j.version}</version>
<!-- http://www.captaindebug.com/2012/01/slf4j-dependencies-and.html#.U24JJnWSzqc-->
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.ops4j.pax.confman</groupId>
<artifactId>pax-confman-propsloader</artifactId>
<version>0.2.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</project>
现在,我想将outputdirectory更改为以下包:
org.eclipse.equinox.ds
org.eclipse.equinox.util
org.eclipse.equinox.device
为此,我将标签
<outputDirectory>${project.build.directory}/myDirectory</outputDirectory>
添加到了标签依赖性中,如下所示: <dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.ds</artifactId>
<version>${org.eclipse.equinox.ds.version}</version>
<outputDirectory>${project.build.directory}/myDirectory</outputDirectory>
</dependency>
但这没用,我得到这个错误:
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.energy-home:jemma:0.2 (/home/fabio/Scrivania/jemma/pom.xml) has 1 error
[ERROR] Malformed POM /home/fabio/Scrivania/jemma/pom.xml: Unrecognised tag: 'outputDirectory' (position: START_TAG seen ...</version>\n\t\t\t<outputDirectory>... @295:21) @ /home/fabio/Scrivania/jemma/pom.xml, line 295, column 21 -> [Help 2]
这是完整的堆栈错误
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] Malformed POM /home/fabio/Scrivania/jemma/pom.xml: Unrecognised tag: 'outputDirectory' (position: START_TAG seen ...</version>\n\t\t\t<outputDirectory>... @295:21) @ /home/fabio/Scrivania/jemma/pom.xml, line 295, column 21
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:363)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:636)
at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:585)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:234)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR]
[ERROR] The project org.energy-home:jemma:0.2 (/home/fabio/Scrivania/jemma/pom.xml) has 1 error
[ERROR] Malformed POM /home/fabio/Scrivania/jemma/pom.xml: Unrecognised tag: 'outputDirectory' (position: START_TAG seen ...</version>\n\t\t\t<outputDirectory>... @295:21) @ /home/fabio/Scrivania/jemma/pom.xml, line 295, column 21 -> [Help 2]
org.apache.maven.model.io.ModelParseException: Unrecognised tag: 'outputDirectory' (position: START_TAG seen ...</version>\n\t\t\t<outputDirectory>... @295:21)
at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:127)
at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:91)
at org.apache.maven.model.building.DefaultModelProcessor.read(DefaultModelProcessor.java:77)
at org.apache.maven.model.building.DefaultModelBuilder.readModel(DefaultModelBuilder.java:456)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:261)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:410)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:379)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:343)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:636)
at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:585)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:234)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: Unrecognised tag: 'outputDirectory' (position: START_TAG seen ...</version>\n\t\t\t<outputDirectory>... @295:21)
at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.checkUnknownElement(MavenXpp3ReaderEx.java:157)
at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.parseDependency(MavenXpp3ReaderEx.java:1721)
at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.parseModel(MavenXpp3ReaderEx.java:2713)
at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.read(MavenXpp3ReaderEx.java:4631)
at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.read(MavenXpp3ReaderEx.java:4590)
at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:118)
... 23 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException
最佳答案
元素“ dependency”内不允许元素“ outputDirectory”。
outputDirectory-是您已编译类的位置,并且依赖项通常是jar文件。
现在,maven将所有依赖项存储在其存储库中,并且仅将依赖项链接到该存储库中其位置。因此,无法更改位置。
也许您希望在执行构建时复制依赖项,可以为此使用插件:http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-project-dependencies.html