java-getopt icon indicating copy to clipboard operation
java-getopt copied to clipboard

Package declaration for GetoptDemo does not match the file's location in the Jar

Open hildo opened this issue 10 years ago • 4 comments

I'm trying to create an OSGi bundle from my source code that uses this library. And it fails with this message

[ERROR] Bundle group:artifact:bundle:1.0.0.alpha01-SNAPSHOT : Class in different directory than declared. Path from class name is GetoptDemo.class but the path in the jar is gnu/getopt/GetoptDemo.class from 'Jar:java-getopt-1.0.9.jar'
[ERROR] Error(s) found in bundle configuration

It looks like this is caused by the GetoptDemo class not declaring a package that matches how the class is packaged in the JAR file

hildo avatar Mar 03 '15 02:03 hildo

By declaring the package for the Demo class, the maven osgi bundle plugin was able to continue

hildo avatar Mar 03 '15 04:03 hildo

Ed, thanks. I'll try to take a look at these patches within a few weeks. But I'm glad you got it working. I haven't touched the code in a long time. Cheers, Aaron.

On Mon, Mar 2, 2015 at 9:52 PM, Ed Hillmann [email protected] wrote:

I'm trying to create an OSGi bundle from my source code that uses this library. And it fails with this message

[ERROR] Bundle minestar.minetracking:minetracking:bundle:1.0.0.alpha01-SNAPSHOT : Class in different directory than declared. Path from class name is GetoptDemo.class but the path in the jar is gnu/getopt/GetoptDemo.class from 'Jar:java-getopt-1.0.9.jar' [ERROR] Error(s) found in bundle configuration

It looks like this is caused by the GetoptDemo class not declaring a package that matches how the class is packaged in the JAR file

— Reply to this email directly or view it on GitHub https://github.com/arenn/java-getopt/issues/5.

Aaron M. Renn [email protected] | www.urbanophile.com | twitter.com/urbanophile

arenn avatar Mar 03 '15 12:03 arenn

No worries.  The patch I submitted simply adds the demo to the package and it all behaved fine in osgi.  I have made some other changes so that I could build the library using Maven (that ant script just wasn't working for me, and it's been too long since I've used make), but I didn't push that to your repo.  I'm using another local copy, though, so don't feel pressured.  Take another 3 years if you need it. :) Thanks,Ed

 On Tuesday, 3 March 2015, 22:16, arenn <[email protected]> wrote:

Ed, thanks. I'll try to take a look at these patches within a few weeks. But I'm glad you got it working. I haven't touched the code in a long time. Cheers, Aaron.

On Mon, Mar 2, 2015 at 9:52 PM, Ed Hillmann [email protected] wrote:

I'm trying to create an OSGi bundle from my source code that uses this library. And it fails with this message

[ERROR] Bundle minestar.minetracking:minetracking:bundle:1.0.0.alpha01-SNAPSHOT : Class in different directory than declared. Path from class name is GetoptDemo.class but the path in the jar is gnu/getopt/GetoptDemo.class from 'Jar:java-getopt-1.0.9.jar' [ERROR] Error(s) found in bundle configuration

It looks like this is caused by the GetoptDemo class not declaring a package that matches how the class is packaged in the JAR file

— Reply to this email directly or view it on GitHub https://github.com/arenn/java-getopt/issues/5.

Aaron M. Renn [email protected] | www.urbanophile.com | twitter.com/urbanophile — Reply to this email directly or view it on GitHub.

hildo avatar Mar 03 '15 21:03 hildo

Looks like this affects Android Studio too:

Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing gnu/getopt/GetoptDemo.class
Error:com.android.dx.cf.iface.ParseException: class name (GetoptDemo) does not match path (gnu/getopt/GetoptDemo.class)

mtbc avatar Jun 07 '18 08:06 mtbc