Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356716 - Tycho stacktraces when configuration is incorrect rather than reporting the problem
Summary: Tycho stacktraces when configuration is incorrect rather than reporting the p...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Tobias Oberlies CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-05 05:33 EDT by Daniel Thomas CLA
Modified: 2021-04-28 16:54 EDT (History)
1 user (show)

See Also:


Attachments
Patch proposal (4.75 KB, patch)
2011-09-14 07:54 EDT, Eckart Langhuth CLA
t-oberlies: iplog+
Details | Diff
Tycho Maven output with NPE (6.19 KB, text/plain)
2011-10-13 09:08 EDT, Julien HENRY CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Thomas CLA 2011-09-05 05:33:54 EDT
Configuring a project to build with tycho for the first time is made considerably more difficult by the fact that any errors in the configuration will likely result in a stacktracee from tycho which doesn't help explain what is wrong rather than going "died because you don't have a 'foo'" or similar.

For example someone else also got:
"Caused by: java.lang.NullPointerException
	at org.eclipse.tycho.plugins.p2.director.ProductConfig.<init>(ProductConfig.java:52)
	at org.eclipse.tycho.plugins.p2.director.AbstractProductMojo.getProductConfig(AbstractProductMojo.java:80)
	at org.eclipse.tycho.plugins.p2.director.DirectorMojo.execute(DirectorMojo.java:42)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
	... 28 more"
Which is what happens if there is no target/products directory because of an configuration error earlier in the build. (for example when building using the eclipse-repository packaging to build an RCP application the absence of a .product file in the same directory as the pom specifying eclipse-repository will cause this)

"The installable unit null has not been found."
If the uid attribute is not specified in the .product file then in org.eclipse.tycho.plugins.p2.publisher.PublishProductMojo.prepareBuildProduct(Product, File, String) at line 89 null is appended to "products/" resulting in it later being used as the name of the installable unit. Instead at this point tycho should bail and state that the uid attribute is missing.
Comment 1 Tobias Oberlies CLA 2011-09-05 06:49:51 EDT
Thanks for reporting this. I totally agree that error handling could be better in many cases. And because we can't just go through the entire code for these kind of problems, it is good to get your examples of bad log messages.
Comment 2 Eckart Langhuth CLA 2011-09-14 07:54:58 EDT
Created attachment 203332 [details]
Patch proposal
Comment 3 Daniel Thomas CLA 2011-09-14 08:06:05 EDT
(In reply to comment #2)
> Created attachment 203332 [details]
> Patch proposal

I think that perhaps there should be some sort of warning given for
"the product publisher did not create the basedir. So there was no project definition file. Nothing to do." noting that they should check that they have a .product file in the right place - silent failure (which appears as success) being slightly more tedious than bailing with an exception.
Comment 4 Tobias Oberlies CLA 2011-10-07 10:25:00 EDT
Fixed with 4633bd5. Thanks for the patch :-)

I added an info log entry in case the the tycho-p2-director-plugin:materialize-products is configured, but there is no product file in the expected location. It is now supported to have materialize-products in the build, although there is no product file. This may be useful for templates/parent POMs.
Comment 5 Julien HENRY CLA 2011-10-13 09:07:09 EDT
For your information I encountered the same stack trace for a totally different reason.
In my corporate parent pom there is this snippet of XML to generate and attach source bundle to every artifact:
		<plugins>
			<!-- Force generation of source bundle even for SNAPSHOTS -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>

But this configuration make the product generation fail because it seems the clean plugin is called during the forked execution so there is no more target folder when the materialize-products goal is called. Using jar-no-fork has fixed the issue but I spend lot of time to find the reason. May be good to display a better error message than NPE.

For information I will attach the build output.
Comment 6 Julien HENRY CLA 2011-10-13 09:08:46 EDT
Created attachment 205118 [details]
Tycho Maven output with NPE