Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build byte-buddy .jar , only byte-budy-deps.jar #17

Closed
DALDEI opened this issue Jan 17, 2015 · 3 comments
Closed

Cannot build byte-buddy .jar , only byte-budy-deps.jar #17

DALDEI opened this issue Jan 17, 2015 · 3 comments
Assignees
Labels

Comments

@DALDEI
Copy link
Contributor

DALDEI commented Jan 17, 2015

The github culture seems to have created an interesting twist to open source .. It is very very rare that I can find a pre-built project / library . The assumption seems to be that noone would want that ... ( this just a background comment, not specific to to BB but its relevent).

Fortuantly I did find byte-budy in the Maven repo ...
I do like cloning or forking projects so I can see the source, but prefer if I get a pre build 'official' libary, especially for Java where its inherently platform neutral. Otherwise its often significant effort and risk to duplicate a build properly (another assumption common on github - that everyone has the same tools and build environments, and knows how to pick the correct branches etc).

I'm learning ! and BB does have actual documentation on building (again rare!)
Very useful as for some reason Maven projects tend to confuse both me and Eclipse ...
I never know what the right command to use, what versions etc and Eclipse gets equally confused.

Thankful for your docs I did exactly this (after cloning from HEAD)
mvn package

it appeared to succeed

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Byte Buddy (parent) ................................ SUCCESS [ 1.234 s]
[INFO] Byte Buddy Java agent .............................. SUCCESS [ 1.806 s]
[INFO] Byte Buddy (with dependencies) ..................... SUCCESS [ 8.480 s]
[INFO] Byte Buddy (without dependencies) .................. SUCCESS [ 0.142 s]
[INFO] Byte Buddy benchmarks .............................. SUCCESS [ 1.694 s]
[INFO] Byte Buddy for Android ............................. SUCCESS [ 0.921 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.397 s
[INFO] Finished at: 2015-01-17T09:35:42-05:00
[INFO] Final Memory: 28M/689M
[INFO] ------------------------------------------------------------------------
E:\Work\DEI\github\byte-buddy>

Except -- only the -dep version has any classes in it

E:\Work\DEI\github\byte-buddy\byte-buddy\target>ls -l
total 14
-rwxr-xr-x 1 DLEE None 5236 Jan 17 09:35 byte-buddy-0.6-SNAPSHOT.jar
E:\Work\DEI\github\byte-buddy\byte-buddy\target>jar t < byte-buddy-0.6-SNAPSHOT.jar
META-INF/
META-INF/MANIFEST.MF
META-INF/maven/
META-INF/maven/net.bytebuddy/
META-INF/maven/net.bytebuddy/byte-buddy/
META-INF/maven/net.bytebuddy/byte-buddy/pom.properties
META-INF/maven/net.bytebuddy/byte-buddy/pom.xml
META-INF/maven/net.bytebuddy/byte-buddy/pom.xml
META-INF/maven/net.bytebuddy/byte-buddy/pom.properties

E:\Work\DEI\github\byte-buddy\byte-buddy-dep\target>ls -l
total 1572
-rwxr-xr-x 1 DLEE None 1021281 Jan 17 09:35 byte-buddy-dep-0.6-SNAPSHOT.jar
META-INF/
META-INF/MANIFEST.MF
...
...
net/bytebuddy/utility/PropertyDispatcher$5.class
net/bytebuddy/utility/PropertyDispatcher$6.class
net/bytebuddy/utility/PropertyDispatcher$7.class
net/bytebuddy/utility/PropertyDispatcher$8.class
net/bytebuddy/utility/PropertyDispatcher$9.class
net/bytebuddy/utility/PropertyDispatcher.class
net/bytebuddy/utility/RandomString.class
net/bytebuddy/utility/StreamDrainer.class
META-INF/maven/net.bytebuddy/byte-buddy-dep/pom.xml

META-INF/maven/net.bytebuddy/byte-buddy-dep/pom.properties

I tried a lot of guessing based on looking at help and what other packages ask for
(I dont know maven more then being able to type "mvn")
mvn install
mvn clean
mvn generate-sources
mvn build

a few dozen like that to no avail.
Eclipse M2 plugin didnt even get that far ...

I was just about to go ahead and use the -dep.jar when I did a little RTFM and found your great docs on NOT to do that ... but fortunately you also said its on Maven Central (had to poke around to find what URL that is) but successfully downloaded the non dep .jar and its working.
( pointing the source to my local git branch )

Any suggestions on what Im doing wrong ?
Im happy to try things and send you the results.

-David

@raphw
Copy link
Owner

raphw commented Jan 17, 2015

Building additional artifacts takes a lot of time, therefore you need to build Byte Buddy with the extras profile to build the repackaged artifact. On ByteBuddy.net, you can find a developers page with some infos on that.

Run: mvn package -Pextras

There is also info in the root pom.

@raphw raphw added the question label Jan 17, 2015
@raphw raphw modified the milestone: 0.2 Jan 17, 2015
@raphw raphw self-assigned this Jan 17, 2015
@DALDEI
Copy link
Contributor Author

DALDEI commented Jan 17, 2015

Success ! Thanks !

First
Thanks for the great work, unless I hit a major issue that cant be resolved, this is going to make it into xmlsh 2.0 - its been a critical missing link i've been struggling with for months and nearly gave up on. I only need a tiny bit of the features but those make the all the difference between a clean simple solution vs a huge gap in functionality. So thank you !

Suggestion: ( I'm happy to add this and send a pull request)
You put a lot of effort into great docs, and this particular bit (using the -deps vs not jar) I wouldn't have even guessed was an issue without your detailed explanation.
With cglib I just guessed (wrong , twice :) and still didn't understand why the 2 libs issue until I stumbled on byte-buddy.

My suggestion - assume the reader doesn't know what you know at a fundamental level,
particularly toolsets, build systems, libraries etc.
Add the build command for generating the non dep version.
It took me less then 1 minute (including failing, then a mvn clean, then it worked)

Without your hint I would never have figured it out, and not for lack of trying ( I spent several hours researching the issue and came up blank ... including reading all the pom files, review a good portion of the source and every kind of web search I could think of). There were no errors, the jar was built, the docs made it clear that using the non -deps was highly encouraged, every thing I could think of did nothing or appeared to work ... except - no classes in the jar file.
This is undoubtable completely obvious to someone who is an expert in maven but i had no clue at all where to even look ...

Its difficult to keep in mind, but regardless of popularity at any point, and especially with things like build tools which take vast efforts to learn and become proficient, and come and go so quickly over time - what seems like 'common knowledge' can often be the exact opposite. Ironically, the entire purpose of build tools is to solve that problem ... but in the process of simplification and abstraction the end result is you need to become an expert in that particular tool in order to understand how to achieve the obvious :) So a new tool comes out that tries to solve the problems of the previous one,
and so we go ... its literally impossible to keep up and still get work done ... ( the other irony of software, people like to write new programs more then improving old ones ... )

So just a suggestion ...

Just 1 or 2 lines more in the docs can be the difference between someone being able to get it to work or giving up.

Writing all this not to complain but to remind myself as much as anyone ... the more you learn the harder it is to remember what you didn't know before. Its the blind spot of knowledge :)

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Byte Buddy (parent) ................................ SUCCESS [ 0.921 s]
[INFO] Byte Buddy Java agent .............................. SUCCESS [ 2.104 s]
[INFO] Byte Buddy (with dependencies) ..................... SUCCESS [ 18.722 s]
[INFO] Byte Buddy (without dependencies) .................. SUCCESS [ 2.787 s]
[INFO] Byte Buddy benchmarks .............................. SUCCESS [ 2.682 s]
[INFO] Byte Buddy for Android ............................. SUCCESS [ 4.114 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.443 s
[INFO] Finished at: 2015-01-17T11:46:42-05:00
[INFO] Final Memory: 32M/706M
[INFO] ------------------------------------------------------------------------

E:\Work\DEI\github\byte-buddy\byte-buddy\target>ls -l *.jar
-rwxr-xr-x 1 DLEE None 4225288 Jan 17 11:46 byte-buddy-0.6-SNAPSHOT-javadoc.jar
-rwxr-xr-x 1 DLEE None 1050915 Jan 17 11:46 byte-buddy-0.6-SNAPSHOT-sources.jar
-rwxr-xr-x 1 DLEE None 1131915 Jan 17 11:46 byte-buddy-0.6-SNAPSHOT.jar
-rwxr-xr-x 1 DLEE None 5236 Jan 17 11:46 original-byte-buddy-0.6-SNAPSHOT.jar

E:\Work\DEI\github\byte-buddy\byte-buddy\target>jar t < byte-buddy-0.6-SNAPSHOT.jar | tai
net/bytebuddy/jar/asm/commons/RemappingFieldAdapter.class
net/bytebuddy/jar/asm/commons/RemappingMethodAdapter.class
net/bytebuddy/jar/asm/commons/RemappingSignatureAdapter.class
net/bytebuddy/jar/asm/commons/SerialVersionUIDAdder$Item.class
net/bytebuddy/jar/asm/commons/SerialVersionUIDAdder.class
net/bytebuddy/jar/asm/commons/SimpleRemapper.class
net/bytebuddy/jar/asm/commons/StaticInitMerger.class
net/bytebuddy/jar/asm/commons/TableSwitchGenerator.class
net/bytebuddy/jar/asm/commons/TryCatchBlockSorter$1.class
net/bytebuddy/jar/asm/commons/TryCatchBlockSorter.class

@raphw
Copy link
Owner

raphw commented Jan 18, 2015

Thanks! I am really glad that you like Byte Buddy. I am happy that all the time spent pays off. I am more than happy to merge the suggested addition. If you stumpled upon it, others will probably stumble, as well. Your bug is fixed and I added an exteded API to make interface creation more easy. Just note that interface methods must always be public.

I want to add some additional API improvements in the upcoming week. Once I am done, I will push the changes to Maven Central. Thank you once again for your kind words.

@raphw raphw closed this as completed Jan 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants