473,811 Members | 3,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Related to adding java source to test jar in Maven

65 New Member
I couldnt get a forum here which catered to Maven, so am putting it here.

Using my pom.xml i was able to generate the jar for src/main/java (say app.jar) as well as for src/test/java (say app-test.jar). I was also able to include my java sources as part of the app.jar (i.e. have both my .class as well as my .java files in the jar).

However for my app-test.jar, i'm not able to include my .class files in it.

This is my pom.xml:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3.   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4.   <modelVersion>4.0.0</modelVersion>
  5.  
  6.   <groupId>com.mycompany.app</groupId>
  7.   <artifactId>my-app</artifactId>
  8.   <version>1.0-SNAPSHOT</version>
  9.   <packaging>jar</packaging>
  10.  
  11.   <name>my-app</name>
  12.   <url>http://maven.apache.org</url>
  13.  
  14.   <properties>
  15.     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  16.   </properties>
  17.  
  18.   <dependencies>
  19.     <dependency>
  20.       <groupId>junit</groupId>
  21.       <artifactId>junit</artifactId>
  22.       <version>3.8.1</version>
  23.       <scope>test</scope>
  24.     </dependency>
  25.   </dependencies>
  26.  
  27.   <build>
  28.     <resources>
  29.       <resource>
  30.         <directory>src/main/java</directory>
  31.       </resource>      
  32.     </resources>
  33.     <plugins>
  34.      <plugin>
  35.        <groupId>org.apache.maven.plugins</groupId>
  36.        <artifactId>maven-jar-plugin</artifactId>
  37.        <version>2.3.1</version>
  38.        <executions>
  39.          <execution>
  40.            <phase>package</phase> 
  41.            <goals>             
  42.              <goal>test-jar</goal>
  43.            </goals>
  44.            <configuration>
  45.             <includes>
  46.                 <include>src/test/java</include>
  47.             </includes>
  48.            </configuration>
  49.          </execution>
  50.        </executions>
  51.      </plugin>
  52.     </plugins>
  53.   </build>
  54.  
  55. </project>
  56.  
Any help would be appreciated.

Thanks.
May 26 '10 #1
0 2137

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3923
by: Jimbo | last post by:
wasn't sure i should put this here or in comp.lang.java.misc (or even comp.lang.misc) but I was wondering what is the consensus for line length for java code? i always thought 80 chars/line was proper, since it handles printing to a printer so well. however, i find myself having to break up lines of code a bit too much with that number. and with today's printers, that's not nearly as true as it was with the dot-matrix. so, i did...
0
1495
by: news.dsl.pipex.com | last post by:
Greetings, I'm trying to find out how in the source you set the version/vendor/title information so that it can be read at runtime. All I've found is mention of ClassLoader in relation to packages. I understand that the info is supposed to be setable for packages and there is a mention of .definePackage for the ClassLoader - but this implies that within say an Applet I have to create a custom ClassLoader for each package
9
5343
by: FISH | last post by:
Ever have one of those days when you're not sure if it's you who's gone mad, or the rest of the world? I have an Open Source project on SourceForge for communication with YSMG - Yahoo's IM protocol. I keep the project source in three directories, based upon the code's function: one for the network API code itself, one for the support APIs (basic chat spam filtering, Swing models, rich text decoders, etc), and one for the test client...
1
1838
by: Peter Verdon | last post by:
For the last two years, I've been using Eclipse as my Java IDE, and I'm very happy with it. I've just switched from Linux to Mac, and while Eclipse itself works even better, I have a problem with the source for the Java libraries. In Eclipse, one can get instant access to the JavaDoc for any class, whether it's part of the current project or a standard one such as, for example, java.util.Vector. In order to do this, Eclipse needs access...
2
6723
by: Edward Berard | last post by:
I am looking for tools that will analyze Java source code: -> I am primarily looking for metrics tools, e.g., tools that will tell me things like - Total lines of code - Total blank lines of code - Total commented lines of code
0
1536
by: Petterson Mikael | last post by:
Hi, I am using Solaris 8 and JDK1.4.1 I will generate java source files from XML. I am thinking of using JAXB package. As input I have my XML and DTD. I setup "Java Web Services Developer Pack 1.2" and tried to create the source files. When I execute the xjc.sh script I have the following options:
2
2287
Saghar
by: Saghar | last post by:
Hi, Could somebody help me about this topic? I want to know how we can call and execute a non-java source file in a java application. For example, a simple Java application is run, there is an image uploaded in JPanel and also a zoom button, now by pressing this button we want to zoom the image using the zoom method of a non-java application such as "Adobe Photoshop", but how to call and execute that method?! I'd greatly appreciate if...
2
5091
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer must be embedded somewhere in the source code, and I would like to know if anyone knows where to find the correct answer. I would greatly appreciate it!! Thanks!! <!--put the preloads file here as it must load before the website class...
1
1630
by: cwj | last post by:
Can anybody tell me some tools that can transfer java source code to cpp source code?
1
1614
by: sreekandan | last post by:
I need Java source code to implement SMTP client side program...So kindly send me the source code for that...
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10395
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5561
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4346
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3874
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3026
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.