You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by samwun <le...@gmail.com> on 2011/07/04 08:04:15 UTC
linking my own application jar file to my maven build.
Hello,
I have created 2 applications:
1. hello-world-service
2. hello-world-service-impl
And then I have created a hello-world-service.jar file for the
hello-world-service package in my hello-world application.
I have executed mvn install command,
[code=java]
sam@sam-PC /cygdrive/c/work/hello-world-start/hello-world-service
$ mvn install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model
for nl.devatwork.hello.world:hello-world-service:jar:1.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-compiler-plugin is missing. @
nl.devatwork.hello.world:hello-world-application:1.0.0-SNAPSHOT,
C:\work\hello-world-start\pom.xml, line 24, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they
threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support
building such malformed projects.
[WARNING]
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Building Dev@Work Hello World Service Contract 1.0.0-SNAPSHOT
[INFO]
------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @
hello-world-service ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @
hello-world-service ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources
(default-testResources) @ hello-world-service ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
C:\work\hello-world-start\hello-world-service\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @
hello-world-service ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @
hello-world-service ---
[INFO] No tests to run.
[INFO] Surefire report directory:
C:\work\hello-world-start\hello-world-service\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
There are no tests to run.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ hello-world-service
---
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @
hello-world-service ---
[INFO] Installing
C:\work\hello-world-start\hello-world-service\target\hello-world-service-1.0.0-SNAPSHOT.jar
to
C:\maven\repository\nl\devatwork\hello\world\hello-world-service\1.0.0-SNAPSHOT\hello-world-service-1.0.0-SNAPSHOT.jar
[INFO] Installing C:\work\hello-world-start\hello-world-service\pom.xml to
C:\maven\repository\nl\devatwork\hello\world\hello-world-service\1.0.0-SNAPSHOT\hello-world-service-1.0.0-SNAPSHOT.pom
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 9.008s
[INFO] Finished at: Mon Jul 04 14:34:05 EST 2011
[INFO] Final Memory: 4M/29M
[INFO]
------------------------------------------------------------------------
[/code]
It seems ok for building and installing the hello-world-service module.
then having error when I tried to build hello-world-service-impl:
[code=java]sam@sam-PC /cygdrive/c/work/hello-world-start/hello-world-service
$ cd ../hello-world-service-impl/
sam@sam-PC /cygdrive/c/work/hello-world-start/hello-world-service-impl
$ mvn clean package
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model
for nl.devatwork.hello.world:hello-world-service-impl:war:1.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-compiler-plugin is missing. @
nl.devatwork.hello.world:hello-world-application:1.0.0-SNAPSHOT,
C:\work\hello-world-start\pom.xml, line 24, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they
threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support
building such malformed projects.
[WARNING]
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Building Dev@Work Hello World Service Implementation 1.0.0-SNAPSHOT
[INFO]
------------------------------------------------------------------------
Downloading:
http://localhost:8081/nexus/content/repositories/thirdparty/nl/devatwork/hello/world/hello-world-application/1.0.0-SNAPSHOT/maven-metadata.xml
Downloading:
http://localhost:8081/nexus/content/repositories/thirdparty/nl/devatwork/hello/world/hello-world-application/1.0.0-SNAPSHOT/hello-world-application-1.0.0-SNAPSHOT.pom
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1.047s
[INFO] Finished at: Mon Jul 04 14:34:32 EST 2011
[INFO] Final Memory: 3M/54M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal on project hello-world-service-impl: Could
not resolve dependencies for project
nl.devatwork.hello.world:hello-world-service-impl:war:1.0.0-SNAPSHOT: Failed
to collect dependencies for [com.liferay.portal:portal-kernel:jar:5.2.8
(provided), com.liferay.portal:portal-service:jar:5.2.8 (provided),
nl.devatwork.hello.world:hello-world-service:jar:1.0.0-SNAPSHOT (provided)]:
Failed to read artifact descriptor for
nl.devatwork.hello.world:hello-world-service:jar:1.0.0-SNAPSHOT: Could not
find artifact
nl.devatwork.hello.world:hello-world-application:pom:1.0.0-SNAPSHOT in
thirdparty (http://localhost:8081/nexus/content/repositories/thirdparty) ->
[Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[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/DependencyResolutionException
[/code]
Here is the parent pom.xml file:
[code=java]<?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>nl.devatwork.hello.world</groupId>
<version>1.0.0-SNAPSHOT</version>
<artifactId>hello-world-application</artifactId>
<packaging>pom</packaging>
<name>Dev@Work Hello World Application</name>
<properties>
<servlet-api.version>2.4</servlet-api.version>
<portlet-api.version>2.0</portlet-api.version>
<liferay.version>5.2.8</liferay.version>
</properties>
<modules>
<module>hello-world-service</module>
<module>hello-world-service-impl</module>
<module>hello-world-portlets</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>[/code]
pom.xml file for hello-world-service module:
[code=java]<?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>nl.devatwork.hello.world</groupId>
<version>1.0.0-SNAPSHOT</version>
<artifactId>hello-world-service</artifactId>
<packaging>jar</packaging>
<name>Dev@Work Hello World Service Contract</name>
<parent>
<groupId>nl.devatwork.hello.world</groupId>
<artifactId>hello-world-application</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
</dependencies>
</project>[/code]
pom.xml file for hello-world-service-impl:
[code=java]<?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>nl.devatwork.hello.world</groupId>
<version>1.0.0-SNAPSHOT</version>
<artifactId>hello-world-service-impl</artifactId>
<packaging>war</packaging>
<name>Dev@Work Hello World Service Implementation</name>
<parent>
<groupId>nl.devatwork.hello.world</groupId>
<artifactId>hello-world-application</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-kernel</artifactId>
<version>${liferay.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>${liferay.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>nl.devatwork.hello.world</groupId>
<artifactId>hello-world-service</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>[/code]
Your suggestion is very appreciated.
Sam
--
View this message in context: http://maven.40175.n5.nabble.com/linking-my-own-application-jar-file-to-my-maven-build-tp4549076p4549076.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: linking my own application jar file to my maven build.
Posted by Guillaume Polet <gu...@gmail.com>.
The parent pom cannot be found, probably because it has never been
installed in your local repository. Go to you hello-world-application
directory and run 'mvn install'. (add the -N switch if you only want to
build the parent pom and not the modules).
Also in your parent pom, add a version number to compiler plugin.
Guillaume
Le 4/07/2011 8:04, samwun a écrit :
> Hello,
>
> I have created 2 applications:
> 1. hello-world-service
> 2. hello-world-service-impl
>
> And then I have created a hello-world-service.jar file for the
> hello-world-service package in my hello-world application.
>
> I have executed mvn install command,
>
> [code=java]
> sam@sam-PC /cygdrive/c/work/hello-world-start/hello-world-service
> $ mvn install
> [INFO] Scanning for projects...
> [WARNING]
> [WARNING] Some problems were encountered while building the effective model
> for nl.devatwork.hello.world:hello-world-service:jar:1.0.0-SNAPSHOT
> [WARNING] 'build.plugins.plugin.version' for
> org.apache.maven.plugins:maven-compiler-plugin is missing. @
> nl.devatwork.hello.world:hello-world-application:1.0.0-SNAPSHOT,
> C:\work\hello-world-start\pom.xml, line 24, column 21
> [WARNING]
> [WARNING] It is highly recommended to fix these problems because they
> threaten the stability of your build.
> [WARNING]
> [WARNING] For this reason, future Maven versions might no longer support
> building such malformed projects.
> [WARNING]
> [INFO]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building Dev@Work Hello World Service Contract 1.0.0-SNAPSHOT
> [INFO]
> ------------------------------------------------------------------------
> [INFO]
> [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @
> hello-world-service ---
> [WARNING] Using platform encoding (GBK actually) to copy filtered resources,
> i.e. build is platform dependent!
> [INFO] Copying 0 resource
> [INFO]
> [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @
> hello-world-service ---
> [INFO] Nothing to compile - all classes are up to date
> [INFO]
> [INFO] --- maven-resources-plugin:2.4.3:testResources
> (default-testResources) @ hello-world-service ---
> [WARNING] Using platform encoding (GBK actually) to copy filtered resources,
> i.e. build is platform dependent!
> [INFO] skip non existing resourceDirectory
> C:\work\hello-world-start\hello-world-service\src\test\resources
> [INFO]
> [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @
> hello-world-service ---
> [INFO] No sources to compile
> [INFO]
> [INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @
> hello-world-service ---
> [INFO] No tests to run.
> [INFO] Surefire report directory:
> C:\work\hello-world-start\hello-world-service\target\surefire-reports
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> There are no tests to run.
>
> Results :
>
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
>
> [INFO]
> [INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ hello-world-service
> ---
> [INFO]
> [INFO] --- maven-install-plugin:2.3.1:install (default-install) @
> hello-world-service ---
> [INFO] Installing
> C:\work\hello-world-start\hello-world-service\target\hello-world-service-1.0.0-SNAPSHOT.jar
> to
> C:\maven\repository\nl\devatwork\hello\world\hello-world-service\1.0.0-SNAPSHOT\hello-world-service-1.0.0-SNAPSHOT.jar
> [INFO] Installing C:\work\hello-world-start\hello-world-service\pom.xml to
> C:\maven\repository\nl\devatwork\hello\world\hello-world-service\1.0.0-SNAPSHOT\hello-world-service-1.0.0-SNAPSHOT.pom
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 9.008s
> [INFO] Finished at: Mon Jul 04 14:34:05 EST 2011
> [INFO] Final Memory: 4M/29M
> [INFO]
> ------------------------------------------------------------------------
>
>
> [/code]
>
> It seems ok for building and installing the hello-world-service module.
>
> then having error when I tried to build hello-world-service-impl:
>
> [code=java]sam@sam-PC /cygdrive/c/work/hello-world-start/hello-world-service
> $ cd ../hello-world-service-impl/
>
> sam@sam-PC /cygdrive/c/work/hello-world-start/hello-world-service-impl
> $ mvn clean package
> [INFO] Scanning for projects...
> [WARNING]
> [WARNING] Some problems were encountered while building the effective model
> for nl.devatwork.hello.world:hello-world-service-impl:war:1.0.0-SNAPSHOT
> [WARNING] 'build.plugins.plugin.version' for
> org.apache.maven.plugins:maven-compiler-plugin is missing. @
> nl.devatwork.hello.world:hello-world-application:1.0.0-SNAPSHOT,
> C:\work\hello-world-start\pom.xml, line 24, column 21
> [WARNING]
> [WARNING] It is highly recommended to fix these problems because they
> threaten the stability of your build.
> [WARNING]
> [WARNING] For this reason, future Maven versions might no longer support
> building such malformed projects.
> [WARNING]
> [INFO]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building Dev@Work Hello World Service Implementation 1.0.0-SNAPSHOT
> [INFO]
> ------------------------------------------------------------------------
> Downloading:
> http://localhost:8081/nexus/content/repositories/thirdparty/nl/devatwork/hello/world/hello-world-application/1.0.0-SNAPSHOT/maven-metadata.xml
> Downloading:
> http://localhost:8081/nexus/content/repositories/thirdparty/nl/devatwork/hello/world/hello-world-application/1.0.0-SNAPSHOT/hello-world-application-1.0.0-SNAPSHOT.pom
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 1.047s
> [INFO] Finished at: Mon Jul 04 14:34:32 EST 2011
> [INFO] Final Memory: 3M/54M
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal on project hello-world-service-impl: Could
> not resolve dependencies for project
> nl.devatwork.hello.world:hello-world-service-impl:war:1.0.0-SNAPSHOT: Failed
> to collect dependencies for [com.liferay.portal:portal-kernel:jar:5.2.8
> (provided), com.liferay.portal:portal-service:jar:5.2.8 (provided),
> nl.devatwork.hello.world:hello-world-service:jar:1.0.0-SNAPSHOT (provided)]:
> Failed to read artifact descriptor for
> nl.devatwork.hello.world:hello-world-service:jar:1.0.0-SNAPSHOT: Could not
> find artifact
> nl.devatwork.hello.world:hello-world-application:pom:1.0.0-SNAPSHOT in
> thirdparty (http://localhost:8081/nexus/content/repositories/thirdparty) ->
> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
> switch.
> [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/DependencyResolutionException
>
> [/code]
>
> Here is the parent pom.xml file:
>
> [code=java]<?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>nl.devatwork.hello.world</groupId>
> <version>1.0.0-SNAPSHOT</version>
> <artifactId>hello-world-application</artifactId>
> <packaging>pom</packaging>
> <name>Dev@Work Hello World Application</name>
>
> <properties>
> <servlet-api.version>2.4</servlet-api.version>
> <portlet-api.version>2.0</portlet-api.version>
> <liferay.version>5.2.8</liferay.version>
> </properties>
>
> <modules>
> <module>hello-world-service</module>
> <module>hello-world-service-impl</module>
> <module>hello-world-portlets</module>
> </modules>
>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.6</source>
> <target>1.6</target>
> </configuration>
> </plugin>
> </plugins>
> </build>
> </project>[/code]
>
> pom.xml file for hello-world-service module:
>
> [code=java]<?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>nl.devatwork.hello.world</groupId>
> <version>1.0.0-SNAPSHOT</version>
> <artifactId>hello-world-service</artifactId>
> <packaging>jar</packaging>
> <name>Dev@Work Hello World Service Contract</name>
>
> <parent>
> <groupId>nl.devatwork.hello.world</groupId>
> <artifactId>hello-world-application</artifactId>
> <version>1.0.0-SNAPSHOT</version>
> </parent>
>
> <dependencies>
> </dependencies>
>
> </project>[/code]
>
> pom.xml file for hello-world-service-impl:
>
> [code=java]<?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>nl.devatwork.hello.world</groupId>
> <version>1.0.0-SNAPSHOT</version>
> <artifactId>hello-world-service-impl</artifactId>
> <packaging>war</packaging>
> <name>Dev@Work Hello World Service Implementation</name>
>
> <parent>
> <groupId>nl.devatwork.hello.world</groupId>
> <artifactId>hello-world-application</artifactId>
> <version>1.0.0-SNAPSHOT</version>
> </parent>
>
> <dependencies>
> <dependency>
> <groupId>com.liferay.portal</groupId>
> <artifactId>portal-kernel</artifactId>
> <version>${liferay.version}</version>
> <scope>provided</scope>
> </dependency>
> <dependency>
> <groupId>com.liferay.portal</groupId>
> <artifactId>portal-service</artifactId>
> <version>${liferay.version}</version>
> <scope>provided</scope>
> </dependency>
> <dependency>
> <groupId>nl.devatwork.hello.world</groupId>
> <artifactId>hello-world-service</artifactId>
> <version>1.0.0-SNAPSHOT</version>
> <scope>provided</scope>
> </dependency>
> </dependencies>
>
> </project>[/code]
>
> Your suggestion is very appreciated.
>
> Sam
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/linking-my-own-application-jar-file-to-my-maven-build-tp4549076p4549076.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org