문제

나는 일반적인 질문이 무엇인지에 적절한 방법으로 관리하는 컴파일하고 배포 jar 종속성입니다.나는 일반적으로 배치 dev 디렉토리에 다음과 같은 간단한 라이브러리/응용 프로그램입니다.

Calculator
   src
   test
   build
   lib
   …

많은 방법이지만,이것은 나의 일반적인 레이아웃에 대한 일반적인 프로젝트입니다.나의 질문의 주위에 회귀 lib 디렉토리에 있습니다.나는 일반적으로 항아리는 나의 프로젝트에 의존 lib 디렉토리에(log4j,etc.) 그래서 컴파일시 설정할 수 있습니다 내 다양한 경로 lib\log4j.jar 입니다.지금 우리가 만들 때 배포 패키지가 있는 경향이 거의 레이아웃입니다.

dist
   Calculator.jar
   lib
      log4j.jar
      addition.jar
      subtraction.jar

이 나에게 허용하거나 설치를 설정하는 스크립트 클래스 경로 내 위치를 기준으로 주요 단지,또 내가 설정할 수 있습니다 클래스 경로에 매니페스트의 주요 항아리(Calculator.jar 이 경우)이지 않을 수도 있는 가장 좋은 방법이 될 이렇게 하려 하지만 그것이 나를 위해 일하는 것을 허용되는 방법을 다루는 종속성으로 다른 개발자가 말했습니다.

나의 질문에 올 때 내가 그 원한을 새로 만드는 프로젝트의 사용이 일부 다른 프로젝트는 뻗어 있다이 방법입니다.

그래서 내가 만들고 싶은 새로운 계산기를 사용하는 프로젝트 계산기 프로젝트에서 샘플니다.경우에 따라 같은 레이아웃을 얻을 것은 다음과 같습니다.

dist
   ScentificCalculator.jar
   lib
      Calculator.jar
      lib 
         Log4j.jar
         addition.jar
         subtraction.jar

물론,이에서 얻을 수 있습의 손이 깊은 귀하의 의존성 트리:

SuperWhizBangCalculator.jar
lib
   ScientificCalculator.jar
   lib 
      Calculator.jar
      lib
         log4j.jar
         addition.jar
         subtraction.jar

또 다른 옵션을 평평무:

SuperWhizBangCalculator
   lib
      ScientificCalculator.jar
      Calculator.jar
      log4J.jar
      addition.jar
      subtraction.jar

하지만 무언가가 그냥하지 않는 것이다.을 잃고 구조를 알려주는 라이브러리와 함께 가는 구성 요소에 의존.그래서 제가 궁금해 있는 경우 커뮤니티 구동하는 표준 방법을 이해하는 결코 한번 크기가 모두 맞출 수 있습니다.

감사는 시간을 위해...

도움이 되었습니까?

해결책

나에게 점프하는 버그는이 줄에 있습니다 :

  status = write (fdsk, ciphertext, strlen (ciphertext)); // bug here
.

나는 당신이 정말로 원하는 것입니다 :

  status = write (fdsk, ciphertext, AES_BLOCK);
.

두 버전은 시간의 대량으로 동일한 결과를 생성 할 수 있지만 때로는 암호문의 중간의 어딘가에있는 바이트 '\ 0'을 생성 한 다음 첫 번째 버전 버전을 원하는 것보다 짧은 무언가로 자리 릅니다. ( Xoring "에서 동일한 문제가 발생합니다."Hello World! "<문자열 ).

XOR 작업에서 0을 모두 얻습니다

XOR 작업의 왼쪽과 오른쪽에 정확히 동일한 값을 가질 때만 발생합니다. 실수로 잘못된 버퍼에 데이터를 복사하거나 나중에 사용할 수 있도록 데이터를 조기에 복사하거나 왼쪽 및 오른쪽의 데이터 복사본을 종료하고 있습니까?

다른 팁

I don't think you'll find a community-driven standard, but I think that overall having a lib-in-a-lib is not a good idea. You risk duplicating many jar files that would be common to your projects. That wastes disk space, and gives you the risk of upgrading the jar that isn't first in your classpath...

I think your third option is the best one.

Also, I would give some thought about how Eclipse manages the links between two different projects... you can put a project in the build path of another project...

QT 플러그인은 동일한 버전의 QT 또는 하위 버전을 사용해야합니다. 에 적재 된 응용 프로그램과 동일한 주 수를 사용해야합니다.

현재 QT SDK에 포함 된 QT 작성자는 Qt 4.7.4를 사용하는 것으로 보이기 때문에 해당 버전의 QWT를 다시 컴파일해야합니다.

을 에코는 또 다른 대답이"왜 그냥 사용 Maven?"

Maven 모든 관리의 종속성을 위해 당신,그 때 다른 프로젝트에 사용하고 싶은 당신의 항아리,그것은 훨씬,훨씬 더 쉽게 그렇게 그들을 위해.이 있는 경우에 대한 표준을 구축,레이아웃과 종속성 Java 세계,그것은 받는다는 것입니다.

Go for your last option - flat lib directory. This is what you'll find if you download any open source project that has dependencies (they may use another level of sub-directory if there's a number of related JARs).

Don't confuse a directory structure with dependency management - they are completely separate things. If you want smart dependency management, then you need to look at something like Maven, ANT with Ivy, or possibly some module system with explicit dependencies (OSGi).

I'd absolutely go with the last approach. Imagine a program A using libraries B and C which both use D. In a structured layout you would have two instances of D around, which is just begging for version conflicts.

The crucial piece of information is how the classes will be loaded. In a "java -jar SuperWhizBang.jar" situation you will have one classloader loading all classes. Then it would make perfect sense to merge the dependencies.

If you choose to have separate classloaders then a hierarchy would be a good idea. This typically happens in an OSGi setting, but that is probably overkill for your solution.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top