Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How are the plugin used in a pom(Maven, pom, shade, assembly, eclipse kepler)
How are the plugin used in a pom [message #1173308] Wed, 06 November 2013 12:31
Pablo S J is currently offline Pablo S JFriend
Messages: 1
Registered: November 2013
Junior Member
Hi,

I am new to eclipse and I understand the basic of POM.

I am trying to make JAR's that contain the dependencies that you can get with maven, but I dont seem to be able to use the plugins that I have found could help me with that.

I think I have specified everything right in the POM, but I cant get the jar to be built, or how is it built?, I know about the export function but what I understand the plugins I am using should take care of this.

My questions are, How do the plugins run?, When do they run?, How can I make them run?

And do this through the GUI IDE, not command line.

Here is my pom

<project xmlns="[LINK I MAY NOT INCLUDE]" xmlns:xsi="[LINK I MAY NOT INCLUDE]"
  xsi:schemaLocation=[LINK I MAY NOT INCLUDE] [LINK I MAY NOT INCLUDE]">
	<modelVersion>4.0.0</modelVersion>
	
	<groupId>com.java.pi</groupId>
	<artifactId>RaspPi</artifactId>
	<packaging>jar</packaging>
	<parent>
		<groupId>com.pi4j</groupId>
		<artifactId>pi4j-parent</artifactId>
		<version>0.0.5</version>
	</parent>
	
	<name>RaspPi</name>
	<url>[LINK I MAY NOT INCLUDE]</url>


	<properties>
		
		<!-- T RASPBERRY PI PROPERTIES -->
		<pi.host>191.0.0.0</pi.host>
		<pi.port>22</pi.port>
		<pi.user>pi</pi.user>
		<pi.password>raspberry</pi.password>
		
		<!-- SETTINGS FOR COPYING Pi4J ARTIFACTS TO DEVELOPMENT RASPBERRY PI -->
		<pi.transfer.dev>false</pi.transfer.dev>
		<pi.host.dev>${pi.host}</pi.host.dev>
		<pi.port.dev>${pi.port}</pi.port.dev>
		<pi.user.dev>${pi.user}</pi.user.dev>
		<pi.password.dev>${pi.password}</pi.password.dev>
		<pi.dirCopyTo.dev>/home/pi/pi4j-dev</pi.dirCopyTo.dev>
		
		<!-- PROJECT ENCODING PROPERTIES -->
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		
	</properties>

  	
 	
	<build>
	
		<resources>
			<resource>
				<directory>${project.build.directory}</directory>
				<filtering>false</filtering>
				<includes>
					<include>LICENSE.txt</include>
					<include>NOTICE.txt</include>
					<include>README.md</include>
				</includes>
			</resource>
		</resources>
	
		<plugins>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.4</version>
				<executions>
					<execution>
						<id>package-jar-with-dependencies</id>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
						<configuration>
							<appendAssemblyId>false</appendAssemblyId>
							<descriptorRefs>
								<descriptorRef>jar-with-dependencies</descriptorRef>
							</descriptorRefs>
							<archive>
							    <manifest>
									<mainClass>com.java.pi.I2CWiiMotionPlusExample</mainClass>
							    </manifest>
							</archive>
						</configuration>
					</execution>
                </executions>
            </plugin>
            
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
			
			<!-- This plugin provides the capability to package the artifact in an uber-jar, including its dependencies and to shade - i.e. rename - the packages of some of the dependencies. -->
	        <plugin>
	            <groupId>org.apache.maven.plugins</groupId>
	            <artifactId>maven-shade-plugin</artifactId>
	            <version>2.1</version>
	            <executions>
	                <execution>
	                    <phase>package</phase>
	                    <goals>
	                        <goal>shade</goal>
	                    </goals>
	                    <configuration>
	                      	                    

	                         <transformers>
	                            <transformer
	                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
	                                <!-- Main class -->
	                                <mainClass>com.java.pi.I2CWiiMotionPlusExample</mainClass>
	                            </transformer>
	                            
	                            <!-- Use resource transformers to prevent file overwrites -->
	                            <transformer 
	                                 implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
	                                <resource>properties.properties</resource>
	                            </transformer>
	                            
	                            <transformer
	                                implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
	                                <resource>applicationContext.xml</resource>
	                            </transformer>
	                            
	                            <transformer
	                                implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
	                                <resource>META-INF/cxf/cxf.extension</resource>
	                            </transformer>
	                            
	                            <transformer
	                                implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
	                                <resource>META-INF/cxf/bus-extensions.xml</resource>
	                            </transformer>
	                            
		                     </transformers>
	                    </configuration>
	                </execution>
	            </executions>
	        </plugin>
	        
			<!-- OPTIONALLY DEPLOY THE FINAL JAR TO THE RASBERRY PI -->
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>

					<!-- copy the compiled JAR file to the Raspberry Pi platform platform -->
					<execution>
						<id>transfer-compiled-pi4j-jar</id>
						<phase>install</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<tasks>
								<taskdef resource="net/sf/antcontrib/antcontrib.properties"
									classpathref="maven.plugin.classpath" />
								<if>
									<equals arg1="${pi.transfer.dev}" arg2="true" />
									<then>
									
										<!-- ensure the target directory exists on the Raspberry Pi -->
										<sshexec host="${pi.host.dev}" port="${pi.port.dev}" username="${pi.user.dev}"
											password="${pi.password.dev}" trust="true" failonerror="false"
											verbose="true" command="mkdir --parents ${pi.dirCopyTo.dev}" />
												
										<!-- copy the JAR file to the Raspberry Pi -->
										<scp
											file="${project.build.directory}/${project.build.finalName}.jar"
											todir="${pi.user.dev}:${pi.password.dev}@${pi.host.dev}:${pi.dirCopyTo.dev}"
											port="${pi.port.dev}" trust="true" verbose="true" failonerror="true">
										</scp>
									</then>
								</if>
							</tasks>
						</configuration>
					</execution>
				</executions>
			</plugin>
			
		</plugins>
		
		
		
	</build>

	<!-- MAVEN REPOSITORIES -->
	<!-- START SNIPPET: maven-repository-snippet -->
	<repositories>
		<repository>
			<id>oss-snapshots-repo</id>
			<name>Sonatype OSS Maven Repository</name>
			<url>[LINK I MAY NOT INCLUDE]</url>
			<snapshots>
				<enabled>true</enabled>
				<updatePolicy>always</updatePolicy>
			</snapshots>
		</repository>
	</repositories>
	<!-- END SNIPPET: maven-repository-snippet -->
	

	<dependencies>
 
		<!-- START SNIPPET: PI4J -->
		<dependency>
			<groupId>com.pi4j</groupId>
			<artifactId>pi4j-core</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>com.pi4j</groupId>
			<artifactId>pi4j-gpio-extension</artifactId>
			<version>${project.version}</version>
		</dependency>
	
		<dependency>
			<groupId>com.pi4j</groupId>
			<artifactId>pi4j-device</artifactId>
			<version>${project.version}</version>
		</dependency>
		<!-- END SNIPPET: PI4J -->
		
	    <dependency>
	      <groupId>junit</groupId>
	      <artifactId>junit</artifactId>
	      <scope>test</scope>
	    </dependency>
    
		<dependency>
			<groupId>log4j</groupId>
				<artifactId>log4j</artifactId>
				<version>1.2.16</version>
		</dependency>		

 	</dependencies>
	
  
</project>

[Updated on: Wed, 06 November 2013 14:57]

Report message to a moderator

Previous Topic:How create folder under eclipse/configuration directory during software install
Next Topic:How to work with eclipse plugin Junit test cases
Goto Forum:
  


Current Time: Tue Mar 02 05:07:04 GMT 2021

Powered by FUDForum. Page generated in 0.02966 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top